[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Texmacs-dev] Cursor left/right movement with wrapping
From: |
Josef Weidendorfer |
Subject: |
[Texmacs-dev] Cursor left/right movement with wrapping |
Date: |
Wed, 8 Dec 2004 18:59:02 +0100 |
User-agent: |
KMail/1.7.1 |
Hi,
I find it a little irritating that pressing key "right" at the and of a line
doesn't go the the start of the next line. This is obviously because cursor
movement is done only in geometrical means, i.e. cursor right always tries to
go to the right. I think that at least if this is not possible, it should
follow the text structure "to the right".
Attached is a small patch to allow left/right cursor movement to wrap at line
starts/ends in the middle of a paragraph. Currently I don't jump among
different tree levels. Aren't there any general document tree navigation
functions? I only found specialized version e.g. for searching.
Similar, I think the following navigation should work:
* Home/End to start/end of line instead of start/end of paragraph
* C+Left/Right to previous/next word
* C+Up/Down to previous/next paragraph
Are patches welcome for this, or is this already possible with keyboard
bindings?
Cheers,
Josef
RCS file: /texmacs/src/src/Edit/Interface/edit_cursor.cpp,v
retrieving revision 1.7
diff -u -p -b -r1.7 edit_cursor.cpp
--- edit_cursor.cpp 23 Sep 2004 11:17:23 -0000 1.7
+++ edit_cursor.cpp 8 Dec 2004 17:50:59 -0000
@@ -48,7 +48,20 @@ edit_cursor_rep::cursor_move_sub (SI& x0
if (ref_p == tree_path (x0, y0, d0+ dx*DELTA)) {
for (i=1; i<DELTA; i=i<<1)
if (ref_p != tree_path (x0+ dx*i, y0+ dy*i, d0+ dx*DELTA)) break;
- if (i>=DELTA) return false;
+ if (i>=DELTA) {
+ if (dx == 0) return false;
+
+ // Try line wrapping for horizontal move
+ path p = path_add(ref_p,dx);
+ if (p == ref_p) return false;
+ cursor cu = eb->find_check_cursor(p);
+ if (!cu->valid) return false;
+ x0 = cu->ox;
+ y0 = cu->oy;
+ d0 = cu->delta;
+ tp = p;
+ return true;
+ }
for (d=i>>2; d>=1; d=d>>1)
- [Texmacs-dev] Cursor left/right movement with wrapping,
Josef Weidendorfer <=