November 2011
2 posts
bifurcating into core and others
Perhaps it would be better to divide rbcurse into rbcurse-core and then other packages or gems. This way core can remain more or less frozen and bug fixes can be released quickly without waiting for other features to stabilize. Changes in other packages can be made without disturbing core. Core can be kept backward compatible. And it can remain light with just form, window, field, buttons, list...
color formatting
Alot has happened since moving to ffi. New widgets and containers, a new tabbedpane that hopefully doesn’t suck and is more rubyesque. However, its amazing how simple the color formatting issue was. Took me only a few minutes to get working with a good regular expression.
The motivation is to be able to have a document with color formatting. I am using the color formatting code of tmux, i.e.,...
September 2011
2 posts
porting to ffi-ncurses
I’ve been working on porting the rbcurse gem to ffi-ncurses, since ncurses gems is so so hard to install for a lot of people. Thanks to Sean’s support the work and retesting was actually very little. It’s just that there is a lot of testing to do with all the programs, widgets. Sean is coming out with a version 0.4.0 which I am using. rbcurse 1.3.0 onwards uses ffi-ncurses.
App.rb confirm before quit
App should be able to configure whether it wants quit-confirm. Or a procedure to call before quitting, such as saving values. It’s okay for demos where there’s no state to just press F1 or q or C-q to quit.
December 2010
1 post
calcurse
Just installed calcurse (port) and was checking the UI. Neat. Some salient points: 1. Windows or panels. Standard with title, title border, border color changes when focus in panel or box (that’s because it keeps updating time and thereofre cursor remains on status bar) 2. 2 bottom lines for keys like we have (keylabels) 3. 3rd last row is a sort of status bar like emacs and vim have 4. Data...
November 2010
2 posts
gmail style email completion
I’ve just implemented some gmail style email completion. As you type in a field, values are shown in a window. You can key UP or DOWN, or keep typing. Pressing ENTER selects highilghted value. You can enter multiple emails in one field and get help on each. However, in this case, the window is not modal, so the form below is painting itself. There are still some old widgets like Label and...
rmessagewindow
Regarding bottomline and rmessagewindow I was thinking that if i try to do bottomline in a separate window that just pops up and goes off, then i don’t have to worry about having a window handle (since a new window is created with each call). I tried out this approach with rmessagewindow. However, first of all one has to press a key to make the message go off. Secondly, when the window goes...
October 2010
5 posts
single and multiple selection and keys
If single selection (by spacebar) then pressing spacebar and pressing Enter should typically have same action. i.e. select current row and fire_event.(X)
If multiple selection, then Enter typically fires an action for current row such as opening an item or giving more details for that item. Spacebar selects multiple items (or Ctrl-Spacebar), and other keys will execute some action on selected...
Usage of preferred_size
when the user may resize a component, or columns in a components, or user may specify widths or heights, we should use a preferred_width field. When we calculate width, use preferred_width if present, else calculate it. Program never updates preferred_width. However, the question is what when a user resizes a component or sub-component. We want to respect that and not overwrite. So currently, i...
color_pair added to widget
Now we may directly pass a color_pair to a widget when creating. This way we can create one color_pair and pass it to multiple widgets, rather than passing actual colors to each. Also, this is a tad more efficient since the color won’t be calculated each time a repaint is done.
stacks and flows - thoughts
It should be possible to maintain stacks and flows within the app class. this way, the app can be asked to reposition the widgets and it can do so. This is required for when we get into using KEY_RESIZE (window resizing). So this will only be available within App, but then that’s where stacks and flows are, anyway. Can we liberate S and F from App and make them independent ?
grabbar and scrollbar focusing
Some objects like grabbars should not be in the way. they should be focusable on some key, or condition. I am thinking of Alt-Tab. Should there be some extra attrib for such since focusable will be false. I could register such objects with a FocusManager array. Upon pressing some key (say F2), it cycles through these and makes then focusable. Works as a toggle. Or on pressing F2, it goes to next...
September 2010
10 posts
Listbox and CellRenderer
Often what is displayed in a listbox is quite different from the data in
the list provided. Such as filenames in the list, but a long list is
dislpayed.
There are several ways to handle this.
I am not addressing obvious performance vs memory issues here. Only
implementation issues and their diffculties wrt display and app
programming.
Keep file names in list. But use the cell renderer to show...
repainting of containers
Seem to be screwing this up. Either I am painting all in repaint which
is not good. Yet, i do not know which are updated. Perhaps one component
has been externally updated, and the container does not know. So its
repaint required is still false.
So … if repaint_required is true, it should repaint the borders, the
components, resize etc.
If repaint_required is false, it still must call...
temporarily leaving ncurses
If i want to run some command, temporarily leave ncurses using
def_prog_mode do stuff and then return. SEE:
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/misc.html#TEMPLEAVE
I think vim does this when you type :ls . One can use this to display
bindings, events etc.
rbcurse's vimsplit (multi-split pane)
Tired of creating Splitpanes within Splitpanes, the Java way. Here’s a much simpler way to get what you want in ONE widget, with very little programming involved.
I’ve called it the VimSplit since its inspired by Vim.
Of course, you can expand and contract them. You can stack more. Much simpler than the earlier SplitPane which i hope to throw out the window.
Change one character,...
testing of widgets
If we keep the model separate, we can test the model out. Helps if the
model is complex like a tree, but what if the model is an inbuilt one
such as a list ?
If the widget keeps UI separate, which includes ncurses, then we can run
tests on it from command line. However, widgets are instantiated with
form and window.!!! How to do change this ?
Can i create objects without passing a...
uniformity and less surprises
we need more uniformity and less surprise. Let ‘text’ be the one method
with ‘def text’ and ‘def text =’, in buttons rename text to label, so
text can be the answer. Same for all widgets. getvalue and get_value etc
sucks.
If a Variable passed in take its value.
thanks to the DSL approach there’s this whole get_ set_ nonsense.
We need to move out the...
making rbcurse easier
Currently making an application in rbcurse, requires a lot of boiler
plate code. Various methods to be called to setup … heck even I can’t
remember them!
I am trying out a wrapper for rbcurse. Much like a file.open block which
does the dirty work of opening and closing a file while the user only
supplies a block.
Then i need to make wrappers for fields and other widgets so they can...
on_enter
i think Form calls on_enter of a widget and also fires its ENTER.
However, looking at the on_enter of some widget;s looks like they also
fire ENTER. So things could get fired 2 times.
August 2010
5 posts
ffi-ncurses ?
there is some talk of ncurses installation which is hindering people
from using rbcurse.
Perhaps we should try moving to ffi-ncurses after all. I heard it was
slow. Is there some way of making it optional, whether a user wishes to
use ffi or ruby-ncurses. For example, i read that mutt can be compiled
for ncurses or slang.
another take on Vimsplit widget
Remember the vimsplit widget. Lets do another take in which we keep one
level of components only. Perhaps i can tile them in one orientation,
and allow user to expand/contract — should be easy since only one
level. We can find some way to have multiple orientations.
This will be easy to code for user, and also to modify
programmatically at run time.
One can even take the MultiContainer and...
some fresh ideas for widgets
I was glancing at this
article
from reddit about Screen Patterns, and the 3 list widget was mentioned
as Column Browse. Also Master Detail.
Column Browse
So I think why not create widgets out of this so that users don’t have
to mess around with multiple SplitPanes to do this. (Note that the
problem in multiple embedded SplitPanes is that the user does not know
how to traverse to a...
other screen patterns
List entry view: Show a simple entry form directly above the total list of items
http://welie.com/patterns/showPattern.php?patternID=list-entry-view
View: much like Hotmail.
http://welie.com/patterns/showPattern.php?patternID=list-entry-view
Product Comparison: Sort of pivot table like, perhaps color columns
http://welie.com/patterns/showPattern.php?patternID=comparison
Directory...
making rbcurse friendlier
I am wondering whether creating rbcurse widgets or apps requires too
much boiler plate code.
Can I make it simpler. The problem i faced (coming from Java) was
inability to have multiple constructors. So the user, and even I, don’t
know for sure what all a widget requires to run.
Can widget creation be made simpler.
I have an idea also for generating widgets and an app through a...
March 2010
4 posts
undo facility - more on it
currently the undo is independent of the textarea and uses the event
object. however, it hardcodes access to the data structures of textarea.
Textarea should make an undo object and pass that. this object would
have an undo and redo method which it has implemented. Also the object
will maintain state of whether it can undo or redo. the undo object may
have an array not just one value.
this way...
"most"-like menus
For menu’s we already have 2 ways:
a menu bar just like the Links browser with sub options, hotkeys, actions etc.
To see this press F2 in test2.rb.
Popup-menus - Similar to the above, popup over a component to show
its options. to see this, iirc the todo app example, if it still
works.
“Pine”-like option labels at the bottom of the screen. Absolutely
identical — check...
entry of string
I’ve brought back entry of a string inside an application.
Until now if one wanted to adhoc ask the user for a string (such as a
search string), one used the dialogs. However, if one wishes to keep the
“gui” to a minimum, rbgetstr (from module Io, io.rb) does the job.
It allows user to abort using C-c, or get specific help using C-g. Or
use the arrow keys or backtab. However, i...
Undo in text widgets
trap insert and delete events
keep a list of
row
curpos
string/char added or deleted
action: ADD or DEL
@current_position in list
Undo() - moves up the list and does the opposite
Redo() - moves down the list and does the same action
February 2010
26 posts
regarding multiplier in embedded components
When i have a textarea inside a scrollpane, and i do C-u, who gets the
numeric argument of 4 or 16, the scrollpane or textarea. Currently,
since the scrollpane passes the key to textarea, so textarea increments
multiplier.
Then i press scroll (M-n), but the scrollpanes multiplier is still
unset.
This means that we cannot have a multiplier at an object level — it
must be a global app level...
double key mapping like vim
The earlier Mapper than i had written was quite good, but integrating that to
get multiple keys into rbcurse would have meant a lot of rework, and perhaps not have
fitted in, with control going to multiple objects and heirarchies of
objects, whereas Mapper takes over control.
So i’ve got a simple thing going, you can test out “gg” in any textview
and it takes you to the start...
scrollpane relevance in terminal apps
Just wondering if scrollpanes have any meaning in a mouseless
environment. The scrollbars have 3 functions:
used to drag down. But for that they have to get focus.
I don’t make scrollbars focussable since that puts focus on too many
objects. I’ve seen demos of some curses toolkits that did, besides
being very low quality and buggy, focus was going to too many objects,
it was...
Fixed breakage in Table. Check testscrolltable.rb
Done the tiny changes to Table. Working now.
Also, Scrollpane increases size of child if child is smaller.
Now to fix TabbedPanes, more work involved here since each situation has
to be taken care of in terms of sizing of child. However, hopefully will
be simpler than Splitpane.
More on splitpanes
Great news. I’ve got sample testsplit3_1.rb working which is an example
with 2 splitpanes inside an outer splitpane.
This exposed an issue, that since the second component’s (right or
bottom) coordinates are determined not when attached but only when the
divider is set, therefore its too late for it to coomunicate that to
some inner components.
Basically, if your second component is...
splitpane = cascade changes is on (rfed16 branch)
In RFED16, i’ve cut down on Pad usage, splitpanes and scrollpanes do not
use pads themselves. Only the final object inserted in it such as a text
are uses a Pad.
Thus there can be cropping issues when a splitpane or scrollpane writes
outside the box. Thus, i switched on cascade_changes (which i had
switched off). That’s why there’s no printing out of the boundary. That...
broken status
Please note that consequent to the simplified buffering, and the way of
calling it from containers the following are broken:
listbox (e.g. testscrolllb.rb, testsplit3b.rb)
table
tabbedpane (container) (e.g. testtpane.rb)
Any program calling buffer_to_screen for a child is broken. The child
now does a buffer_to_window using absolute coordinates.
Containers such as SplitPane and ScrollPane...
Now quite some success with splits and scrolls...
with testsplit3a.rb working (rfed16 branch), resizing etc is working fine,
finally splitpanes and scrollpanes are in decent shape.
There are still some programs not displaying okay .. 3b 3_1 — have to
see what’s there.
Were those 2 ever working ? or was it only a cursor issue in them that
wrecked everything and made me abandon rbcurse19 branch. I wonder how
that branch is...
scrollpanes inside splitpanes
The issue with placing a scrollpane a splitpane, esp in the second pane
of a split.
Currently, a SPLP sets its second components (C2’s) row and col and
other buffer parameters only after its divider has been set.
Thus, when there is SPLP inside another SPLP, even the inner SPLP is
able to inform its child of location when its divider is recomputed.
However, scrollpane informs its child of...
cursor positioning
I can’t believe this. It seems I am not longer using ext_offsets any
longer??
I am setting the absolute coords of child components in scrollpane and
splitpanes, which is kinda good, because its simple and no magic
involved. No having 2 sets of coordinates around.
Also, it seems widgtes are using buffer_to_window, which also uses
absolute coordinates for the screen.
Lastly, textview and...
changing width and height
Wherever an object changes its childs dimensions, it should now also
call set_buffering to update :bottom and :right (or :top and :left),
since we are now using buffer_to_window in Widget which takes explicit
values from this hash.
Earlier, Pad picked up values from the pad, and otherwin and then tried
to make sense of what to use. Thus coincidentally some things worked,
some did not.
Now that...
changed to SplitPane (rfed16 version)
Currently, Splitpane was in a sorry state meaning mostly the values
passed by higher functions for locating both the comps and their cursor
values. Parameters passed were based on how things were working inside
and it made no sense.
I’ve tried to make the parameters logical and sensible, and the inside
functioning should work with those parameters rather than the other way
round.
...
giving up on splitpanes without buffers
Okay, i am not having fun with subwindows. Too much existing code it has
to work with.
Not having buffers at all is tough, since one can easily print outside
the widget while moving it. Especially the boundaries.
So i might have to just go back to the dreaded buffered version. Only
problem is going back to that version that worked perfectly except for
the one condition in which a scrollpane...
subwins > derwin
Okay, i’ve got ncurses subwins to resize and move, since they have absolute
coordinates (unlike derwins) which lose their orientation. However, my
scrollbar repainting is sucking since i need to paint it on the
underlying window/subwin.
Somehow it prints a line 2 times - duh. Will have to see how far i can
go with approach.
subwin does not resize and move
subwins were working great for my splitpane (vimsplit) till i needed to
implement the pane movement. That requires moving and resizing subwins.
This was not happening since the coords are relative to the parent
window, and somehow this link is lost. The moved window lands up with
its relative coordinates as absolute coords now.
The man page says that subwindows resizing and movement should...
vimsplits or splitpane with subwins
I was just checking out subwins today and one thing led to another. I
basically have a very barebones vim-splitty thing which has subwins for
each split - VimSplit.
It splits in half, yes, i need to allow moving. I’ve been wasting time
putting text in each split.
So each split returns 2 subwins. You can either attach a component to a
split, so all keys go to it.
Or else create a form with...
ext_offsets explanation
ext_row_offset and ext_col_offset are essentially for a widget to be
able to place the cursor. This is exactly how to set this variable.
A form, when adding a widget puts its window.top and window.left as row
and col offset respectively.
In cases, where an object contains another object such as ScrollPane or
SplitPane, ext_row_offset is set to row ext_row_offset of...