]> git.neil.brown.name Git - edlib.git/log
edlib.git
10 years agoIntroduce PointDup command
NeilBrown [Wed, 25 Nov 2015 07:58:05 +0000 (18:58 +1100)]
Introduce PointDup command

This make it possible to get a dup of point without
explicitly finding the point. Makes it more indirect.

You this in 'search' to avoid hunting up the tree.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoDon't make new point directly in doc_attach
NeilBrown [Wed, 25 Nov 2015 07:48:19 +0000 (18:48 +1100)]
Don't make new point directly in doc_attach

sometimes we want point_new sometimes point_dup

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoSplit a 'doc' pane aways from the 'view' panes.
NeilBrown [Wed, 25 Nov 2015 07:21:27 +0000 (18:21 +1100)]
Split a 'doc' pane aways from the 'view' panes.

They really are different things.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agouse new doc_attach_view for attaching "view"
NeilBrown [Wed, 25 Nov 2015 05:35:52 +0000 (16:35 +1100)]
use new doc_attach_view for attaching "view"

This is a common task and it is good to centralize it.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoSplit doc_attach_view from doc_open.
NeilBrown [Wed, 25 Nov 2015 05:31:31 +0000 (16:31 +1100)]
Split doc_attach_view from doc_open.

It is silly combining these two functions with very different results.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agouse pane and mark to pass document to doc:set-attr
NeilBrown [Wed, 25 Nov 2015 04:59:09 +0000 (15:59 +1100)]
use pane and mark to pass document to doc:set-attr

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange doc:get-attr to use a pane rather than a point.
NeilBrown [Wed, 25 Nov 2015 04:55:39 +0000 (15:55 +1100)]
Change doc:get-attr to use a pane rather than a point.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoUse doc_notify_change rather than point_notify_change were possible.
NeilBrown [Wed, 25 Nov 2015 04:54:06 +0000 (15:54 +1100)]
Use doc_notify_change rather than point_notify_change were possible.

This gives more flexibility going forward.

Make sure doc_notify_change is just as fast when a point is provided.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoUse pane rather then point to pass doc to doc:step
NeilBrown [Wed, 25 Nov 2015 04:41:51 +0000 (15:41 +1100)]
Use pane rather then point to pass doc to doc:step

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoUse pane instead of point to pass doc to "Release"
NeilBrown [Wed, 25 Nov 2015 04:37:32 +0000 (15:37 +1100)]
Use pane instead of point to pass doc to "Release"

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange doc:set-ref to take a pane rather than a point.
NeilBrown [Wed, 25 Nov 2015 04:32:37 +0000 (15:32 +1100)]
Change doc:set-ref to take a pane rather than a point.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange doc_find to return a pane.
NeilBrown [Wed, 25 Nov 2015 03:38:15 +0000 (14:38 +1100)]
Change doc_find to return a pane.

That fits the pattern better.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoRemove the document list and use a list of panes instead.
NeilBrown [Wed, 25 Nov 2015 03:19:10 +0000 (14:19 +1100)]
Remove the document list and use a list of panes instead.

The 'null display' (ed->root.focus) is now the parent of multiple
panes, each of which owns a document (->data) with a backlink
(doc->home->data == doc).

Now in many places we pass around this pane instead of a point when we
just want to identify a document and not a location in the document.
This means we don't need to allocate points so much, or fake up
temporary ones.

doc_attach() must be used at document creation to attach a document to
the tree.

So
 - "*Documents*" watches this list of siblings rather than the original list.
 - commands can be sent to these panes using key_handle_focus.  Some
   doc commands can be sent to any pane.
 - doc creation returns the pane of the document in ci->focus
   rather than a fake point
     e.g. same_file, load_file

 - pane_attach() takes a pane, not a point.
 - doc_open no-longer needs a gross hack
 - editor_choose_doc returns a pane, and so doesn't need a point.
 - popup holds the doc pane, not a point.

etc.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange 'editor' to be the root of the pane tree.
NeilBrown [Tue, 24 Nov 2015 22:36:50 +0000 (09:36 +1100)]
Change 'editor' to be the root of the pane tree.

Displays are all children of that root.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange doc:reundo and doc:get-str to use the pane-path.
NeilBrown [Tue, 24 Nov 2015 21:59:45 +0000 (08:59 +1100)]
Change doc:reundo and doc:get-str to use the pane-path.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agosend "doc:replace" up the pane path
NeilBrown [Tue, 24 Nov 2015 21:45:10 +0000 (08:45 +1100)]
send "doc:replace" up the pane path

Reduces need for passing points and documents around.
There will be more of this.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agotext: fix bug with refresh when text added to start of first line.
NeilBrown [Tue, 24 Nov 2015 21:23:25 +0000 (08:23 +1100)]
text: fix bug with refresh when text added to start of first line.

The return value didn't match the comment...

Signed-off-by: NeilBrown <neil@brown.name>
10 years agotext: fix undo/redo bug.
NeilBrown [Tue, 24 Nov 2015 21:12:29 +0000 (08:12 +1100)]
text: fix undo/redo bug.

we move the point ref forward, and them move along the mark list
to match.
But we need to go *beyond* any mark at the same position
else when we step the ref forward we won't know to keep going....
It is confusing, but this doesn't crash.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoRemove the doc_operations structure complete.
NeilBrown [Tue, 24 Nov 2015 08:51:38 +0000 (19:51 +1100)]
Remove the doc_operations structure complete.

After all, it is empty now.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoMake 'step' a command.
NeilBrown [Tue, 24 Nov 2015 08:48:47 +0000 (19:48 +1100)]
Make 'step' a command.

This is the most-used command, I really have to optimise this one day.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoMake mark_same into a command.
NeilBrown [Tue, 24 Nov 2015 08:33:21 +0000 (19:33 +1100)]
Make mark_same into a command.

Having two marks and a point in cmd_info isn't good.
Maybe I can get rid of one later.

This is probably quite inefficient.  Using the '2' version
might help.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoIntroduce mark_order_not_same
NeilBrown [Tue, 24 Nov 2015 06:14:22 +0000 (17:14 +1100)]
Introduce mark_order_not_same

it seems to have lots of potential users.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoUse mark_ordered_or_same once more.
NeilBrown [Tue, 24 Nov 2015 06:05:50 +0000 (17:05 +1100)]
Use mark_ordered_or_same once more.

Signed-off-by: NeilBrown <neil@brown.name>
10 years ago->replace is now doc:replace
NeilBrown [Tue, 24 Nov 2015 05:57:35 +0000 (16:57 +1100)]
->replace is now doc:replace

I wonder if it should boe "Replace" ??

Signed-off-by: NeilBrown <neil@brown.name>
10 years agomake get_attr a command.
NeilBrown [Tue, 24 Nov 2015 05:51:28 +0000 (16:51 +1100)]
make get_attr a command.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange set_attr into a command.
NeilBrown [Tue, 24 Nov 2015 05:38:31 +0000 (16:38 +1100)]
Change set_attr into a command.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange ->reundo from doc_operation to command
NeilBrown [Tue, 24 Nov 2015 05:32:33 +0000 (16:32 +1100)]
Change ->reundo from doc_operation to command

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoInitial save-file support.
NeilBrown [Tue, 24 Nov 2015 04:29:05 +0000 (15:29 +1100)]
Initial save-file support.

C-x C-s now saves the file if there is a file name.
No errors are reported if anything goes wrong.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd DEF_LOOKUP_CMD
NeilBrown [Tue, 24 Nov 2015 04:09:24 +0000 (15:09 +1100)]
Add DEF_LOOKUP_CMD

This makes it easy to handle the common case of a dispatcher command.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorename mainloop.c to edlib.c
NeilBrown [Tue, 24 Nov 2015 03:45:23 +0000 (14:45 +1100)]
rename mainloop.c to edlib.c

There is nothing loopy about this file..

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange set_ref to be a command instead of directory_op
NeilBrown [Tue, 24 Nov 2015 03:27:17 +0000 (14:27 +1100)]
Change set_ref to be a command instead of directory_op

More messyness with passing documents - time to fix that.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoMove some common mark list initialisation to a single function.
NeilBrown [Tue, 24 Nov 2015 03:15:58 +0000 (14:15 +1100)]
Move some common mark list initialisation to a single function.

This results in only one place that calls ->set_ref

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange ->destroy from doc_operation to command.
NeilBrown [Tue, 24 Nov 2015 02:54:12 +0000 (13:54 +1100)]
Change ->destroy from doc_operation to command.

It is a bit messy passing a bare doc to a command at the moment,
but I have plans...

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAllow doc_destroy to destroy any left-over points
NeilBrown [Tue, 24 Nov 2015 02:50:55 +0000 (13:50 +1100)]
Allow doc_destroy to destroy any left-over points

 ... like it does with marks.

Seemed like a good idea...

Signed-off-by: NeilBrown <neil@brown.name>
10 years agochange get_str from a doc_operations to a command.
NeilBrown [Tue, 24 Nov 2015 01:48:10 +0000 (12:48 +1100)]
change get_str from a doc_operations to a command.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange doc_load_file and doc_same_file from doc_operations to commands.
NeilBrown [Tue, 24 Nov 2015 01:18:12 +0000 (12:18 +1100)]
Change doc_load_file and doc_same_file from doc_operations to commands.

Eventually I hope for all doc_operations to disappear.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoRemove point_ref
NeilBrown [Tue, 24 Nov 2015 00:29:21 +0000 (11:29 +1100)]
Remove point_ref

it is unused and not needed.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoRemove mark_of_point
NeilBrown [Tue, 24 Nov 2015 00:22:45 +0000 (11:22 +1100)]
Remove mark_of_point

it is a hang over from when I though 'point' might be a private
data structure.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd lib/ to .gitignore
NeilBrown [Tue, 24 Nov 2015 00:09:29 +0000 (11:09 +1100)]
Add lib/ to .gitignore

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-lines: draw cursor on inactive panes.
NeilBrown [Tue, 24 Nov 2015 00:07:43 +0000 (11:07 +1100)]
render-lines: draw cursor on inactive panes.

This feels a big hacking, but it is nice to know where the cursor is.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-lines: make sure cursor appears in empty file.
NeilBrown [Mon, 23 Nov 2015 09:00:05 +0000 (20:00 +1100)]
render-lines: make sure cursor appears in empty file.

when point is at the end of a line it is also at the start of the next
line, and this can cause confusion.

Resolve by preferring the start of the next line (even if it is the
non-existent line at end of file) unless the end of the previous line
in not in the first column (e.g. no newline at end-of-file).

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd document-name completion for find-document
NeilBrown [Mon, 23 Nov 2015 07:39:12 +0000 (18:39 +1100)]
Add document-name completion for find-document

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd filename completion in find-file.
NeilBrown [Mon, 23 Nov 2015 07:28:06 +0000 (18:28 +1100)]
Add filename completion in find-file.

A new renderer "render-complete" shows a select set of
lines from a given buffer and allows one to be selected.
Put this in a pop-up with the target directory and the
given prefix, and nice things happen.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-format: when at end-of-file, we aren't at start-of-line.
NeilBrown [Mon, 23 Nov 2015 06:14:09 +0000 (17:14 +1100)]
render-format: when at end-of-file, we aren't at start-of-line.

This is the one possible point that isn't start-of-line, so
be careful of it.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd a "render-lines:redraw" function.
NeilBrown [Mon, 23 Nov 2015 06:11:49 +0000 (17:11 +1100)]
Add a "render-lines:redraw" function.

A little bit of a hack...
This allows a virtual document to tell the renderer that
it should redraw everything even thought the document hasn't
actually changed.  I probably should find a better way to do this.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-lines: allow and empty header to remove a default.
NeilBrown [Mon, 23 Nov 2015 06:08:50 +0000 (17:08 +1100)]
render-lines: allow and empty header to remove a default.

If a doc type has a default heading, this allows "" to be set
somewhere to remove the heading.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agopopup: allow a document to be provided for a popup.
NeilBrown [Mon, 23 Nov 2015 06:04:04 +0000 (17:04 +1100)]
popup: allow a document to be provided for a popup.

A pre-existing document - such as a directory listing - can
now be provided for a popup instead of the defaul empty text document.
In this case the "Return" which closes the popup should carry the
returned content.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agopopup: make sure popup is at a higher z level than target.
NeilBrown [Mon, 23 Nov 2015 05:59:58 +0000 (16:59 +1100)]
popup: make sure popup is at a higher z level than target.

This can be important when creating a popup for a popup
(e.g. drop-down menu for file selector)

Signed-off-by: NeilBrown <neil@brown.name>
10 years agopopup: capture "Return" rather than "Replace".
NeilBrown [Mon, 23 Nov 2015 05:57:04 +0000 (16:57 +1100)]
popup: capture "Return" rather than "Replace".

I don't recall why I did this, maybe it was back when the Return
would have looked like emacs-Return or vi-Return.

anyway, this makes more sense now.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoFix to problems with pane_masked
NeilBrown [Mon, 23 Nov 2015 05:53:30 +0000 (16:53 +1100)]
Fix to problems with pane_masked

1/ off-by-one error case cause us no to clear just beyond a pane
2/ only reduce 'w', and 'h', don't increase.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agodocs_open: on failure, don't destroy a pre-existing document.
NeilBrown [Mon, 23 Nov 2015 05:51:31 +0000 (16:51 +1100)]
docs_open: on failure, don't destroy a pre-existing document.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange render_attach to return that attached pane.
NeilBrown [Mon, 23 Nov 2015 05:48:50 +0000 (16:48 +1100)]
Change render_attach to return that attached pane.

this may not be necessary, but it seems useful and is consistent
with pane_attach().

Signed-off-by: NeilBrown <neil@brown.name>
10 years agopane_attach: always return the top-level attached pane.
NeilBrown [Mon, 23 Nov 2015 05:38:59 +0000 (16:38 +1100)]
pane_attach: always return the top-level attached pane.

It is fairly easy to find the leaf with pane_final_child().
It is harder to find the top.  So return that.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAlways attach a renderer as a leaf.
NeilBrown [Mon, 23 Nov 2015 04:54:19 +0000 (15:54 +1100)]
Always attach a renderer as a leaf.

This always makes sense, and we don't always easliy have the leaf
available.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange doc_open to optionally return the point.
NeilBrown [Mon, 23 Nov 2015 00:15:36 +0000 (11:15 +1100)]
Change doc_open to optionally return the point.

this is a gross hack,  It'll get cleaned up eventually.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoRemove last arg from pane_reparent.
NeilBrown [Mon, 23 Nov 2015 04:39:36 +0000 (15:39 +1100)]
Remove last arg from pane_reparent.

It is of no use.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoIntroduce mark_to_mark.
NeilBrown [Mon, 23 Nov 2015 04:38:07 +0000 (15:38 +1100)]
Introduce mark_to_mark.

Like point_to_mark, but moves any more to another mark in the same
document.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoIntroduce pane_final_child()
NeilBrown [Mon, 23 Nov 2015 04:28:27 +0000 (15:28 +1100)]
Introduce pane_final_child()

We open-code this a few places and will need it more soon.

It is paritcularly useful after attaching a pane which might attach a
collection.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agochange render-hex to use render-lines
NeilBrown [Sun, 22 Nov 2015 07:07:27 +0000 (18:07 +1100)]
change render-hex to use render-lines

This removes lots of code.

side-shifting isn't perfect though, you cannot get
back to seeing the addresses.  Need to think about that.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agodoc-dir: add symbolic attrs for listing.
NeilBrown [Sun, 22 Nov 2015 05:41:34 +0000 (16:41 +1100)]
doc-dir: add symbolic attrs for listing.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-lines: fix problem with early freeing of marks.
NeilBrown [Sun, 22 Nov 2015 05:18:15 +0000 (16:18 +1100)]
render-lines: fix problem with early freeing of marks.

render-lines assumes that all the vmarks are always distinct.  However
it is possible for changes in the document to make them collide.  If
that happens, delete excess marks to maintain the invarient.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoeditor_choose_doc should avoid docs being deleted.
NeilBrown [Sun, 22 Nov 2015 05:11:28 +0000 (16:11 +1100)]
editor_choose_doc should avoid docs being deleted.

If a doc is being deleted, then don't try to re-use it.
Unless only the documents-doc remains.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agodoc_close_views mustn't close newly added views.
NeilBrown [Sun, 22 Nov 2015 05:08:20 +0000 (16:08 +1100)]
doc_close_views mustn't close newly added views.

It is possible for a view to be added while others
are deleted.  This happens when a view loses it's doc
and adds another and only finds the one it lost.

So use a mark/sweep still approach to only delete pre-existing views.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoMake doc_close_views static and use doc_destroy.
NeilBrown [Sun, 22 Nov 2015 05:03:56 +0000 (16:03 +1100)]
Make doc_close_views static and use doc_destroy.

The only reason to close views on a doc is when destroying it,
so call doc_close_views directly from doc_destroy, not from elsehwere.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoFix text_round_len usage in text_ref_same
NeilBrown [Sun, 22 Nov 2015 02:41:07 +0000 (13:41 +1100)]
Fix text_round_len usage in text_ref_same

text_round_usage must be called with a len *less* than the len
of the string.

Thanks to valgrind for finding this.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoFix a few bugs found by valgrind
NeilBrown [Sat, 21 Nov 2015 08:17:59 +0000 (19:17 +1100)]
Fix a few bugs found by valgrind

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd 'find in other window' command to dir and doc listings.
NeilBrown [Sat, 21 Nov 2015 07:33:24 +0000 (18:33 +1100)]
Add 'find in other window' command to dir and doc listings.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoSwitch *Documents* to use the render-format
NeilBrown [Sat, 21 Nov 2015 06:47:25 +0000 (17:47 +1100)]
Switch *Documents* to use the render-format

New render-dir is redundant.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agodoc-dir: add key bindings for directory view
NeilBrown [Sat, 21 Nov 2015 06:42:29 +0000 (17:42 +1100)]
doc-dir: add key bindings for directory view

These should probably be more indirect ... later

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-lines: add "heading" support.
NeilBrown [Sat, 21 Nov 2015 06:31:24 +0000 (17:31 +1100)]
render-lines: add "heading" support.

Useful for directory listings.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-format: more fixes for cursor movement.
NeilBrown [Sat, 21 Nov 2015 06:16:43 +0000 (17:16 +1100)]
render-format: more fixes for cursor movement.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-format: fix problem with up/down and click start-of-line
NeilBrown [Sat, 21 Nov 2015 04:52:30 +0000 (15:52 +1100)]
render-format: fix problem with up/down and click start-of-line

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-format: improvements for cursor positioning and movement.
NeilBrown [Sat, 21 Nov 2015 04:45:02 +0000 (15:45 +1100)]
render-format: improvements for cursor positioning and movement.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoUpdate rpos when copying ref
NeilBrown [Sat, 21 Nov 2015 04:49:47 +0000 (15:49 +1100)]
Update rpos when copying ref

There must be a better way to do this..

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-lines: fix placement of cursor at end of file.
NeilBrown [Sat, 21 Nov 2015 04:40:52 +0000 (15:40 +1100)]
render-lines: fix placement of cursor at end of file.

Particularly if file doesn't end with a newline.

Also allow a click several lines after EOF to move cursor to EOF.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoChange meaning for return value for "Refresh"
NeilBrown [Fri, 20 Nov 2015 23:48:13 +0000 (10:48 +1100)]
Change meaning for return value for "Refresh"

Allowing "Refresh" to return 0 was always wrong.  Returning zero
should mean no command as found.
Allowing it to return non-zero to mean "apply changes to children"
is now unused, so discard that.

Now all Refresh functions that do something return 1.  So if no such
function was found, call pane_check_size() to ensure that size matches
parent, as that is a basic requirement of simple panes.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-format: add missing 'close' and 'clone' functionality.
NeilBrown [Fri, 20 Nov 2015 23:41:31 +0000 (10:41 +1100)]
render-format: add missing 'close' and 'clone' functionality.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorename render_lines_follow_point to render_lines_other_move
NeilBrown [Fri, 20 Nov 2015 23:33:13 +0000 (10:33 +1100)]
rename render_lines_follow_point to render_lines_other_move

Because that is a better description of why it is called, and
it does more than just causing point to be followed.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agorender-lines: improve Move-Lines for forward motion.
NeilBrown [Fri, 20 Nov 2015 23:31:33 +0000 (10:31 +1100)]
render-lines: improve Move-Lines for forward motion.

Using mark_next to go from end of one line to start of next
is not very generic.
So do Move-EOL forward and extra time, and then Move-EOL backwards.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd render-format.
NeilBrown [Fri, 20 Nov 2015 22:56:44 +0000 (09:56 +1100)]
Add render-format.

This renders one document element per line using a format string
and attributes to create content, and using render-lines to display
on the pane.

This is particularly useful for dir listing and the document list.

This will replace render-dir.

This doesn't quite work right yet  - in particular lines up/down is wrong.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd render-lines.
NeilBrown [Fri, 20 Nov 2015 22:51:21 +0000 (09:51 +1100)]
Add render-lines.

render-lines renders a pane given a 'render-lines' function on the
underlying document.  It handles charact-wrapping or line-truncation
and side-shifting.
It determines how many lines need to be rendered to fill the pane,
and handles movement related to the pane (page up/down, line up/down).

This should make it easier to write individual render functions.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoncurses: does draw before/above pane.
NeilBrown [Fri, 20 Nov 2015 22:33:07 +0000 (09:33 +1100)]
ncurses: does draw before/above pane.

We already avoid drawing text if w or h is less than x or y.
also avoid if x or y is negative.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agopane_attr_get: access doc attributes too.
NeilBrown [Fri, 20 Nov 2015 22:32:01 +0000 (09:32 +1100)]
pane_attr_get: access doc attributes too.

When searching for attributes for a pane, any pane that has a document
attaches inherits attributes from that document.

10 years agoSimplify view-eol
NeilBrown [Wed, 18 Nov 2015 02:54:09 +0000 (13:54 +1100)]
Simplify view-eol

We only use 'pt' to get 'doc', so just take 'doc' directly.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agotext: fix some issues with UTF-8
NeilBrown [Wed, 18 Nov 2015 02:51:18 +0000 (13:51 +1100)]
text: fix some issues with UTF-8

When adjusting a string to avoid being in the middle
of a UTF-8 code point, I botched it..

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoncurses: fix bug that caused us to lose some mouse events.
NeilBrown [Wed, 18 Nov 2015 02:47:21 +0000 (13:47 +1100)]
ncurses: fix bug that caused us to lose some mouse events.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd 'misc' core code: text accumulation buffer.
NeilBrown [Wed, 18 Nov 2015 02:46:02 +0000 (13:46 +1100)]
Add 'misc' core code: text accumulation buffer.

This allows us to easily build strings for temporary uses.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoFix uninitialised variable in lib-tile
NeilBrown [Wed, 18 Nov 2015 02:45:07 +0000 (13:45 +1100)]
Fix uninitialised variable in lib-tile

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd new 'mark' support functions.
NeilBrown [Wed, 18 Nov 2015 02:44:18 +0000 (13:44 +1100)]
Add new 'mark' support functions.

vmark is useful if you have lots of marks in a view.
mark_ordered_or_same() is occasionally useful.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoMerge branch 'master' of home.neil.brown.name:GIT/edlib
NeilBrown [Mon, 16 Nov 2015 09:51:08 +0000 (20:51 +1100)]
Merge branch 'master' of home.neil.brown.name:GIT/edlib

10 years agoAllow marks in a view to have extra space allocated.
NeilBrown [Mon, 16 Nov 2015 02:04:48 +0000 (13:04 +1100)]
Allow marks in a view to have extra space allocated.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoTidy up definition of search_again
NeilBrown [Mon, 16 Nov 2015 00:31:39 +0000 (11:31 +1100)]
Tidy up definition of search_again

I missed it in recent clean-up

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoDo pane-mapping calls in ncurses_text.
NeilBrown [Mon, 16 Nov 2015 00:29:22 +0000 (11:29 +1100)]
Do pane-mapping calls in ncurses_text.

These are needed for every character printed, so keep
them local to the one function so it can be called directly
after an initial search.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agocmd_info: introduce hx and hy
NeilBrown [Mon, 16 Nov 2015 00:14:13 +0000 (11:14 +1100)]
cmd_info: introduce hx and hy

These are co-ordinates relative to ->home.
This leaves ->x and ->y always relative to ->focus.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoUse ->focus to return pane from attach- functions.
NeilBrown [Sun, 15 Nov 2015 23:53:23 +0000 (10:53 +1100)]
Use ->focus to return pane from attach- functions.

Other functions that return a pane use ->focus, and I think
that is a better choice.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoUse ->extra instead of ->str[0] to pass a wide-char to pane-text
NeilBrown [Sun, 15 Nov 2015 23:50:04 +0000 (10:50 +1100)]
Use ->extra instead of ->str[0] to pass a wide-char to pane-text

after all, a wch_t doesn't fit in a char.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoStore command in cmd_info
NeilBrown [Sun, 15 Nov 2015 22:55:30 +0000 (09:55 +1100)]
Store command in cmd_info

This allows us to repeat a command several times without repeating the
lookup sequence every time.  This (hopefullys) makes sense for using
commands for drawing on a display.

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoExport key_handle() and use instead of misusing key_handle_xy().
NeilBrown [Sun, 15 Nov 2015 22:07:22 +0000 (09:07 +1100)]
Export key_handle() and use instead of misusing key_handle_xy().

Also tidy-up a few users of key_handle_??

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoAdd C-s to *Welcome* document
NeilBrown [Sun, 15 Nov 2015 09:24:38 +0000 (20:24 +1100)]
Add C-s to *Welcome* document

Signed-off-by: NeilBrown <neil@brown.name>
10 years agosearch: del the view from the correct document.
NeilBrown [Sun, 15 Nov 2015 09:22:17 +0000 (20:22 +1100)]
search: del the view from the correct document.

Also make sure to handle "Release" properly if doc_close_views
gets called before the pane is closed.

Signed-off-by: NeilBrown <neil@brown.name>