c-mode after auto-indention wrong cursor position

Peter Hoffmann <[email protected]>
Newsgroups gmane.editors.qemacs.devel
Message-ID <1058141946.9184.18.camel@star>
Hello,
after auto indention (initiated by pressing ; or {) the cursor does not
stay at the end of line, but jumps to beginnig + indention.

Small patch to correct this in clang.c within. 

Regards,
-- 
Peter Hoffmann

_______________________________________________
Qemacs-devel mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/qemacs-devel
patch (text/plain, 977 B)
--- qemacs-0.3.1/clang.c	2003-04-22 00:01:42.000000000 +0200
+++ qemacs_test/clang.c	2003-07-14 01:56:40.000000000 +0200
@@ -285,7 +285,7 @@
 
 static void do_c_indent(EditState *s)
 {
-    int offset, offset1, offset2, offsetl, c, pos, size, line_num, col_num;
+    int offset, offset_start, offset1, offset2, offsetl, c, pos, size, line_num, col_num;
     int i, eoi_found, len, pos1, lpos, style, line_num1, state;
     unsigned int buf[MAX_BUF_SIZE], *p;
     unsigned char stack[MAX_STACK_SIZE];
@@ -296,6 +296,7 @@
     eb_get_pos(s->b, &line_num, &col_num, s->offset);
     line_num1 = line_num;
     offset = s->offset;
+    offset_start = s->offset;
     offset = eb_goto_bol(s->b, offset);
     /* now find previous lines and compute indent */
     pos = 0;
@@ -481,7 +482,7 @@
     }
     /* insert needed spaces */
     insert_spaces(s, &offset, pos);
-    s->offset = offset;
+    s->offset = offset_start-size+pos;
 }
     
 void do_c_indent_region(EditState *s)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.