[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs TODO clang.c hex.c latex-mode.c list.c q...
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs TODO clang.c hex.c latex-mode.c list.c q... |
Date: |
Wed, 12 Dec 2007 02:51:05 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 07/12/12 02:51:05
Modified files:
. : TODO clang.c hex.c latex-mode.c list.c qe.c
qe.h qeconfig.h shell.c util.c xml.c
Log message:
simplified set_color API, made in inline
improved command parsing, refined argval handling, pass as optional arg
pass command arguments as an array of unions
use correct type in command dispatcher (upto 2 arguments)
merged do_goto_byte, do_goto_line, do_goto_char, extend syntax
fixed kill commands: kills are appended/prepended to kill buffer
added append_next_kill command
added do_kill_line (split from do_kill_region)
added do_kill_word (removed do_delete_word)
added do_kill_paragraph
pass argval to do_backspace and do_delete_char, fix kill behaviour
fixed kill-ring initial state bug
fixed do_yank: set mark and this_cmd_func
fixed do_yank_pop: test last_cmd_func, use eb_delete instead of do_undo
fixed do_yank_pop kill-ring bug
added clamp(int x, int min, int max);
added qs->this_cmd_func so commands can override qs->last_cmd_func
allow KEY_ESC + extended key as command binding
added do_c_forward_block, needs rewrite using colorization code
added do_c_kill_block
added insert-char command (argval repeats instead of forcing char value)
renamed delete-word to kill-word
renamed backward-delete-word to backward-kill-word
added kill-beginning-of-line
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/TODO?cvsroot=qemacs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/qemacs/hex.c?cvsroot=qemacs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/qemacs/latex-mode.c?cvsroot=qemacs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/qemacs/list.c?cvsroot=qemacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/qemacs/qeconfig.h?cvsroot=qemacs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/qemacs/util.c?cvsroot=qemacs&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/qemacs/xml.c?cvsroot=qemacs&r1=1.6&r2=1.7
Patches:
Index: TODO
===================================================================
RCS file: /cvsroot/qemacs/qemacs/TODO,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- TODO 6 Feb 2007 17:41:16 -0000 1.10
+++ TODO 12 Dec 2007 02:51:05 -0000 1.11
@@ -23,8 +23,8 @@
- implement wheel mode in CSS display.
- check console charset support (need to convert input?)
- test Hebrew keymap support.
-- kill buffer handling: append next kill as command flag
-- delete word should be a kill operation
+DONE - kill buffer handling: append next kill as command flag
+DONE - delete word should be a kill operation
- indent-with-tabs
DONE - increase MAX_SCREEN_WIDTH and MAX_SCREEN_HEIGHT beyond 256
- fix crash bug on fragments longer than MAX_SCREEN_WIDTH.
@@ -39,7 +39,7 @@
* global QTAGS file indexed with global includes
- see if java/javascript/c++ is OK.
- autocomplete
-- forward-level, backward-level: skipping balanced parentheses
+DONE - forward-level, backward-level: skipping balanced parentheses
- forward-ifdef, backward-ifdef, show-ifdefs
- automatic indentation detection
@@ -79,7 +79,7 @@
- expression evaluator
- dos/mac translation modes
- minor modes with key override such as "preview" mode
-NOPE - redefine KEY_Fx to make them sequential
+- redefine KEY_Fx to make them sequential
- use failsafe memory allocator and longjmp recover.
- scroll up/down with argument should scroll by screen row.
- simplify C-z A-z accordingly
Index: clang.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/clang.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- clang.c 10 Dec 2007 13:28:08 -0000 1.12
+++ clang.c 12 Dec 2007 02:51:05 -0000 1.13
@@ -115,14 +115,14 @@
p++;
}
}
- set_color(p_start, p - p_start, QE_STYLE_COMMENT);
+ set_color(p_start, p, QE_STYLE_COMMENT);
} else
if (*p == '/') {
/* line comment */
parse_comment1:
state = C_COMMENT1;
p = buf + len;
- set_color(p_start, p - p_start, QE_STYLE_COMMENT);
+ set_color(p_start, p, QE_STYLE_COMMENT);
if (p > buf && (p[-1] & CHAR_MASK) != '\\')
state = 0;
}
@@ -133,7 +133,7 @@
state = C_PREPROCESS;
/* incorrect if preprocessing line contains a comment */
p = buf + len;
- set_color(p_start, p - p_start, QE_STYLE_PREPROCESS);
+ set_color(p_start, p, QE_STYLE_PREPROCESS);
if (p > buf && (p[-1] & CHAR_MASK) != '\\')
state = 0;
goto the_end;
@@ -174,7 +174,7 @@
p++;
}
}
- set_color(p_start, p - p_start, QE_STYLE_STRING);
+ set_color(p_start, p, QE_STYLE_STRING);
break;
case '=':
p++;
@@ -193,7 +193,7 @@
while (*p == ' ' || *p == '\t')
p++;
if (strfind(c_keywords, kbuf, 0)) {
- set_color(p_start, p1 - p_start, QE_STYLE_KEYWORD);
+ set_color(p_start, p1, QE_STYLE_KEYWORD);
} else
if (strfind(c_types, kbuf, 0)
|| (l > 2 && kbuf[l - 2] == '_' && kbuf[l - 1] == 't')) {
@@ -202,12 +202,12 @@
if (*p != ')') {
type_decl = 1;
}
- set_color(p_start, p1 - p_start, QE_STYLE_TYPE);
+ set_color(p_start, p1, QE_STYLE_TYPE);
} else
if (*p == '(') {
/* function call */
/* XXX: different styles for call and definition */
- set_color(p_start, p1 - p_start, QE_STYLE_FUNCTION);
+ set_color(p_start, p1, QE_STYLE_FUNCTION);
} else {
/* assume typedef if starting at first column */
if (p_start == buf)
@@ -216,9 +216,9 @@
if (type_decl) {
if (p_start == buf) {
/* assume type if first column */
- set_color(p_start, p1 - p_start, QE_STYLE_TYPE);
+ set_color(p_start, p1, QE_STYLE_TYPE);
} else {
- set_color(p_start, p1 - p_start,
QE_STYLE_VARIABLE);
+ set_color(p_start, p1, QE_STYLE_VARIABLE);
}
}
}
@@ -568,11 +568,153 @@
return ret;
}
+/* forward / backward preprocessor */
+static void do_c_forward_preprocessor(EditState *s, int dir)
+{
+}
+
+/* forward / backward block */
+#define MAX_LEVEL 20
+
+static void do_c_forward_block(EditState *s, int dir)
+{
+ char balance[MAX_LEVEL];
+ int c, c1, offset, offset0, level;
+
+ /* XXX: should use colorization to deal with syntax */
+ level = 0;
+ offset0 = offset = s->offset;
+ if (dir < 0) {
+ for (; offset > 0;) {
+ c = eb_prevc(s->b, offset, &offset);
+ switch (c) {
+ case ')':
+ c1 = '(';
+ goto push;
+ case ']':
+ c1 = '[';
+ goto push;
+ case '}':
+ c1 = '{';
+ push:
+ if (level < MAX_LEVEL) {
+ balance[level] = c1;
+ }
+ level++;
+ continue;
+ case '(':
+ case '[':
+ case '{':
+ if (level > 0) {
+ --level;
+ if (balance[level] != c) {
+ put_status(s, "Unmatched delimiter");
+ return;
+ }
+ if (level <= 0)
+ goto the_end;
+ }
+ continue;
+ default:
+ continue;
+ }
+ }
+ } else {
+ for (;;) {
+ c = eb_nextc(s->b, offset, &offset);
+ again:
+ switch (c) {
+ case '\n':
+ if (offset >= s->b->total_size)
+ goto the_end;
+ continue;
+ case '(':
+ c1 = ')';
+ goto push1;
+ case '[':
+ c1 = ']';
+ goto push1;
+ case '{':
+ c1 = '}';
+ push1:
+ if (level < MAX_LEVEL) {
+ balance[level] = c1;
+ }
+ level++;
+ continue;
+ case ')':
+ case ']':
+ case '}':
+ if (level > 0) {
+ --level;
+ if (balance[level] != c) {
+ put_status(s, "Unmatched delimiter");
+ return;
+ }
+ if (level <= 0)
+ goto the_end;
+ }
+ continue;
+ case '/':
+ c = eb_nextc(s->b, offset, &offset);
+ if (c == '/') {
+ while ((c = eb_nextc(s->b, offset, &offset)) != '\n')
+ continue;
+ } else
+ if (c == '*') {
+ for (;;) {
+ while ((c = eb_nextc(s->b, offset, &offset)) != '*') {
+ if (offset >= s->b->total_size)
+ goto the_end;
+ }
+ while ((c = eb_nextc(s->b, offset, &offset)) == '*')
+ continue;
+ if (c == '/')
+ break;
+ }
+ continue;
+ } else {
+ goto again;
+ }
+ default:
+ continue;
+ }
+ }
+ }
+the_end:
+ s->offset = offset;
+}
+
+static void do_c_kill_block(EditState *s, int dir)
+{
+ int start = s->offset;
+
+ if (s->b->flags & BF_READONLY)
+ return;
+
+ do_c_forward_block(s, dir);
+ do_kill(s, start, s->offset, dir);
+}
+
/* specific C commands */
static CmdDef c_commands[] = {
CMD_( KEY_CTRL('i'), KEY_NONE, "c-indent-command", do_c_indent, "*")
CMD_( KEY_META(KEY_CTRL('\\')), KEY_NONE, "c-indent-region",
do_c_indent_region, "*")
+ /* should map to KEY_META + KEY_CTRL_LEFT ? */
+ CMDV( KEY_META(KEY_CTRL('b')), KEY_NONE,
+ "c-backward-block", do_c_forward_block, -1, "*v")
+ /* should map to KEY_META + KEY_CTRL_RIGHT */
+ CMDV( KEY_META(KEY_CTRL('f')), KEY_NONE,
+ "c-forward-block", do_c_forward_block, 1, "*v")
+ CMDV( KEY_META(KEY_CTRL('k')), KEY_NONE,
+ "c-kill-block", do_c_kill_block, 1, "*v")
+ CMDV( KEY_ESC, KEY_DELETE,
+ "c-backward-kill-block", do_c_kill_block, -1, "*v")
+ CMDV( KEY_META('['), KEY_NONE,
+ "c-backward-preprocessor", do_c_forward_preprocessor, -1, "*v")
+ CMDV( KEY_META(']'), KEY_NONE,
+ "c-forward-preprocessor", do_c_forward_preprocessor, 1, "*v")
/* CG: should use 'k' intrinsic argument */
CMDV( ';', KEY_NONE, "c-electric-semi&comma", do_c_electric, ';', "*v")
CMDV( ':', KEY_NONE, "c-electric-colon", do_c_electric, ':', "*v")
Index: hex.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/hex.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- hex.c 6 Dec 2007 17:43:48 -0000 1.10
+++ hex.c 12 Dec 2007 02:51:05 -0000 1.11
@@ -92,13 +92,6 @@
return -1;
}
-static void do_goto_byte(EditState *s, int offset)
-{
- if (offset < 0 || offset >= s->b->total_size)
- return;
- s->offset = offset;
-}
-
static void do_set_width(EditState *s, int w)
{
if (w >= 1) {
@@ -124,8 +117,8 @@
static CmdDef hex_commands[] = {
CMD1( KEY_NONE, KEY_NONE, "decrease-width", do_incr_width, -1)
CMD1( KEY_NONE, KEY_NONE, "increase-width", do_incr_width, 1)
- CMD_( KEY_NONE, KEY_NONE, "set-width", do_set_width, "i{Width: }")
- CMD_( KEY_META('g'), KEY_NONE, "goto-byte", do_goto_byte, "i{Goto byte: }")
+ CMD_( KEY_NONE, KEY_NONE, "set-width", do_set_width, "ui{Width: }")
+ CMDV( KEY_META('g'), KEY_NONE, "goto-byte", do_goto, 'b', "us{Goto byte:
}v")
CMD0( KEY_NONE, KEY_NONE, "toggle-hex", do_toggle_hex)
CMD_DEF_END,
};
Index: latex-mode.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/latex-mode.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- latex-mode.c 6 Dec 2007 17:43:48 -0000 1.15
+++ latex-mode.c 12 Dec 2007 02:51:05 -0000 1.16
@@ -57,7 +57,7 @@
}
if (*p == '\'' && *++p == '\'')
p++;
- set_color(p_start, p - p_start, QE_STYLE_STRING);
+ set_color(p_start, p, QE_STYLE_STRING);
}
break;
case '\\':
@@ -69,7 +69,7 @@
while (*p != '{' && *p != '[' && *p != '\n' && *p != ' ' && *p
!= '\\')
p++;
}
- set_color(p_start, p - p_start, QE_STYLE_FUNCTION);
+ set_color(p_start, p, QE_STYLE_FUNCTION);
while (*p == ' ' || *p == '\t') {
/* skip space */
p++;
@@ -80,7 +80,7 @@
p_start = p;
while (*p != ']' && *p != '\n')
p++;
- set_color(p_start, p - p_start, QE_STYLE_KEYWORD);
+ set_color(p_start, p, QE_STYLE_KEYWORD);
if (*p == ']')
p++;
} else {
@@ -97,7 +97,7 @@
}
p++;
}
- set_color(p_start, p - p_start, QE_STYLE_VARIABLE);
+ set_color(p_start, p, QE_STYLE_VARIABLE);
if (*p == '}')
p++;
}
@@ -112,7 +112,7 @@
/* line comment */
while (*p != '\n')
p++;
- set_color(p_start, p - p_start, QE_STYLE_COMMENT);
+ set_color(p_start, p, QE_STYLE_COMMENT);
break;
default:
p++;
Index: list.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/list.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- list.c 3 Dec 2007 16:10:39 -0000 1.3
+++ list.c 12 Dec 2007 02:51:05 -0000 1.4
@@ -33,10 +33,10 @@
if (((qs->active_window == s) || s->force_highlight) &&
s->offset >= offset && s->offset < offset1) {
/* highlight the line if the cursor is inside */
- set_color(buf, len, QE_STYLE_HIGHLIGHT);
+ set_color(buf, buf + len, QE_STYLE_HIGHLIGHT);
} else if (buf[0] == '*') {
/* selection */
- set_color(buf, len, QE_STYLE_SELECTION);
+ set_color(buf, buf + len, QE_STYLE_SELECTION);
}
return len;
}
Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- qe.c 10 Dec 2007 13:28:08 -0000 1.38
+++ qe.c 12 Dec 2007 02:51:05 -0000 1.39
@@ -309,7 +309,7 @@
/* add default bindings */
for (d = cmds; d->name != NULL; d++) {
- if (d->key == KEY_CTRL('x')) {
+ if (d->key == KEY_CTRL('x') || d->key == KEY_ESC) {
unsigned int keys[2];
keys[0] = d->key;
keys[1] = d->alt_key;
@@ -566,6 +566,21 @@
s->offset = eb_next_paragraph(s->b, s->offset);
}
+void do_kill_paragraph(EditState *s, int dir)
+{
+ int start = s->offset;
+
+ if (s->b->flags & BF_READONLY)
+ return;
+
+ if (dir < 0)
+ do_backward_paragraph(s);
+ else
+ do_forward_paragraph(s);
+
+ do_kill(s, start, s->offset, dir);
+}
+
#define PARAGRAPH_WIDTH 76
void do_fill_paragraph(EditState *s)
@@ -720,35 +735,38 @@
}
}
-void do_delete_word(EditState *s, int dir)
+void do_delete_char(EditState *s, int argval)
{
- int start = s->offset;
- int end;
+ int end, i, offset1;
if (s->b->flags & BF_READONLY)
return;
- if (s->mode->move_word_left_right)
- s->mode->move_word_left_right(s, dir);
- end = s->offset;
- if (start < end)
- eb_delete(s->b, start, end-start);
- else
- eb_delete(s->b, end, start-end);
-}
-
-void do_delete_char(EditState *s)
-{
- int offset1;
-
+ if (argval == NO_ARG) {
eb_nextc(s->b, s->offset, &offset1);
eb_delete(s->b, s->offset, offset1 - s->offset);
+ } else
+ if (argval) {
+ /* save kill if universal argument given */
+ end = s->offset;
+ for (i = argval; i > 0 && end < s->b->total_size; i--) {
+ eb_nextc(s->b, end, &end);
+ }
+ for (i = argval; i < 0 && end > 0; i++) {
+ eb_prevc(s->b, end, &end);
+ }
+ do_kill(s, s->offset, end, argval);
+ }
}
-void do_backspace(EditState *s)
+void do_backspace(EditState *s, int argval)
{
int offset1;
+ if (s->b->flags & BF_READONLY)
+ return;
+
+ if (argval == NO_ARG) {
eb_prevc(s->b, s->offset, &offset1);
if (offset1 < s->offset) {
eb_delete(s->b, offset1, s->offset - offset1);
@@ -757,6 +775,10 @@
if (s->compose_len > 0)
s->compose_len--;
}
+ } else {
+ /* save kill if universal argument given */
+ do_delete_char(s, -argval);
+ }
}
/* return the cursor position relative to the screen. Note that xc is
@@ -855,6 +877,7 @@
s->mode->move_left_right(s, dir);
}
+/* CG: Should move this to EditState */
static int up_down_last_x = -1;
void text_move_up_down(EditState *s, int dir)
@@ -1381,56 +1404,95 @@
QEmacsState *qs = &qe_state;
EditBuffer *b;
+ if (qs->yank_buffers[qs->yank_current]) {
if (++qs->yank_current == NB_YANK_BUFFERS)
qs->yank_current = 0;
b = qs->yank_buffers[qs->yank_current];
if (b)
eb_free(b);
+ }
b = eb_new("*yank*", BF_SYSTEM);
qs->yank_buffers[qs->yank_current] = b;
return b;
}
-void do_kill_region(EditState *s, int killtype)
+void do_append_next_kill(EditState *s)
{
- int len, p1, p2, tmp, offset1;
+ /* do nothing! */
+}
+
+void do_kill(EditState *s, int p1, int p2, int dir)
+{
+ int len, tmp;
QEmacsState *qs = s->qe_state;
EditBuffer *b;
if (s->b->flags & BF_READONLY)
return;
- p2 = s->offset;
- if (killtype == 2) {
- /* kill line */
- if (eb_nextc(s->b, p2, &offset1) == '\n') {
- p1 = offset1;
- } else {
- p1 = p2;
- while (eb_nextc(s->b, p1, &offset1) != '\n') {
- p1 = offset1;
- }
- }
- } else {
- /* kill/copy region */
- p1 = s->b->mark;
- }
-
if (p1 > p2) {
tmp = p1;
p1 = p2;
p2 = tmp;
}
len = p2 - p1;
+ b = qs->yank_buffers[qs->yank_current];
+ if (!b || !dir || qs->last_cmd_func != do_append_next_kill) {
+ /* append kill if last command was kill already */
b = new_yank_buffer();
- eb_insert_buffer(b, 0, s->b, p1, len);
- if (killtype) {
+ }
+ /* insert at beginning or end depending on kill direction */
+ eb_insert_buffer(b, dir < 0 ? 0 : b->total_size, s->b, p1, len);
+ if (dir) {
eb_delete(s->b, p1, len);
s->offset = p1;
+ qs->this_cmd_func = do_append_next_kill;
}
selection_activate(qs->screen);
}
+void do_kill_region(EditState *s, int killtype)
+{
+ do_kill(s, s->b->mark, s->offset, killtype);
+}
+
+void do_kill_line(EditState *s, int dir)
+{
+ int p1, p2, offset1;
+
+ if (s->b->flags & BF_READONLY)
+ return;
+
+ p1 = s->offset;
+ if (dir < 0) {
+ /* kill beginning of line */
+ do_bol(s);
+ p2 = s->offset;
+ } else {
+ /* kill line */
+ if (eb_nextc(s->b, p1, &offset1) == '\n') {
+ p2 = offset1;
+ } else {
+ p2 = offset1;
+ while (eb_nextc(s->b, p2, &offset1) != '\n') {
+ p2 = offset1;
+ }
+ }
+ }
+ do_kill(s, p1, p2, dir);
+}
+
+void do_kill_word(EditState *s, int dir)
+{
+ int start = s->offset;
+
+ if (s->b->flags & BF_READONLY)
+ return;
+
+ do_word_right(s, dir);
+ do_kill(s, start, s->offset, dir);
+}
+
void do_yank(EditState *s)
{
int size;
@@ -1443,25 +1505,35 @@
/* if the GUI selection is used, it will be handled in the GUI code */
selection_request(qs->screen);
+ s->b->mark = s->offset;
b = qs->yank_buffers[qs->yank_current];
- if (!b)
- return;
+ if (b) {
size = b->total_size;
if (size > 0) {
eb_insert_buffer(s->b, s->offset, b, 0, size);
s->offset += size;
}
+ }
+ qs->this_cmd_func = do_yank;
}
void do_yank_pop(EditState *s)
{
QEmacsState *qs = s->qe_state;
- /* XXX: should verify if last command was a yank */
- do_undo(s);
- /* XXX: not strictly correct if the ring is not full */
- if (--qs->yank_current < 0)
- qs->yank_current = NB_YANK_BUFFERS - 1;
+ if (qs->last_cmd_func != do_yank) {
+ put_status(s, "Previous command was not a yank");
+ return;
+ }
+
+ eb_delete(s->b, s->b->mark, s->offset - s->b->mark);
+
+ if (--qs->yank_current < 0) {
+ /* get last yank buffer, yank ring may not be full */
+ qs->yank_current = NB_YANK_BUFFERS;
+ while (--qs->yank_current && !qs->yank_buffers[qs->yank_current])
+ continue;
+ }
do_yank(s);
}
@@ -1696,18 +1768,71 @@
s->wrap = WRAP_WORD;
}
-void do_goto_line(EditState *s, int line)
+/* do_goto: move point to a specified position.
+ * take string and default unit,
+ * string is parsed as an integer with an optional unit and suffix
+ * units: (b)yte, (c)har, (w)ord, (l)line, (%)percentage
+ * optional suffix :col or .col for column number in goto_line
+ */
+
+void do_goto(EditState *s, const char *str, int unit)
{
- if (line < 1)
+ const char *p;
+ int pos, line, col, rel;
+
+ rel = (*str == '+' || *str == '-');
+ pos = strtol(str, (char**)&p, 0);
+
+ if (memchr("bcwl%", *p, 5))
+ unit = *p++;
+
+ switch (unit) {
+ case 'b':
+ if (*p)
+ goto error;
+ if (rel)
+ pos += s->offset;
+ s->offset = clamp(pos, 0, s->b->total_size);
return;
- s->offset = eb_goto_pos(s->b, line - 1, 0);
+ case 'c':
+ if (*p)
+ goto error;
+ if (rel)
+ pos += eb_get_char_offset(s->b, s->offset);
+ s->offset = eb_goto_char(s->b, max(0, pos));
+ return;
+ case '%':
+ pos = pos * (long long)s->b->total_size / 100;
+ if (rel)
+ pos += s->offset;
+ eb_get_pos(s->b, &line, &col, max(pos, 0));
+ line += (col > 0);
+ goto getcol;
+
+ case 'l':
+ line = pos - 1;
+ if (rel || pos == 0) {
+ eb_get_pos(s->b, &line, &col, s->offset);
+ line += pos;
+ }
+ getcol:
+ col = 0;
+ if (*p == ':' || *p == '.') {
+ col = strtol(p + 1, (char**)&p, 0);
+ }
+ if (*p)
+ goto error;
+ s->offset = eb_goto_pos(s->b, max(0, line), col);
+ return;
+ }
+error:
+ put_status(s, "invalid position: %s", str);
}
-void do_goto_char(EditState *s, int pos)
+void do_goto_line(EditState *s, int line)
{
- if (pos < 0)
- return;
- s->offset = eb_goto_char(s->b, pos);
+ if (line >= 1)
+ s->offset = eb_goto_pos(s->b, line - 1, 0);
}
void do_count_lines(EditState *s)
@@ -2822,6 +2947,7 @@
for (l = s->colorize_nb_valid_lines; l <= line_num; l++) {
len = eb_get_line(s->b, buf, buf_size - 1, &offset);
+ // XXX: should force \0 instead of \n
buf[len] = '\n';
s->colorize_func(buf, len, &colorize_state, 1);
@@ -2832,11 +2958,13 @@
/* compute line color */
len = eb_get_line(s->b, buf, buf_size - 1, &offset1);
+ // XXX: should force \0 instead of \n
buf[len] = '\n';
colorize_state = s->colorize_states[line_num];
s->colorize_func(buf, len, &colorize_state, 0);
+ /* XXX: if state is same as previous, minimize invalid region? */
s->colorize_states[line_num + 1] = colorize_state;
s->colorize_nb_valid_lines = line_num + 2;
@@ -3133,15 +3261,16 @@
#endif
}
-enum CmdArgType {
- CMD_ARG_INT = 0,
- CMD_ARG_INTVAL,
- CMD_ARG_STRING,
- CMD_ARG_STRINGVAL,
- CMD_ARG_WINDOW,
-};
-
-#define MAX_CMD_ARGS 5
+typedef struct ExecCmdState {
+ EditState *s;
+ CmdDef *d;
+ int nb_args;
+ int argval;
+ const char *ptype;
+ CmdArg args[MAX_CMD_ARGS];
+ unsigned char args_type[MAX_CMD_ARGS];
+ char default_input[512]; /* default input if none given */
+} ExecCmdState;
/* XXX: potentially non portable on weird architectures */
/* Minimum assumptions are:
@@ -3169,27 +3298,31 @@
* passed as pointers (but long arguments are not supported anyway).
* should pass function signature for direct dispatch.
*/
-void call_func(void *func, int nb_args, void **args,
- __unused__ unsigned char *args_type)
+void call_func(void *func, int nb_args, CmdArg *args,
+ unsigned char *args_type)
{
switch (nb_args) {
case 0:
((void (*)(void))func)();
break;
case 1:
- ((void (*)(void *))func)(args[0]);
+ ((void (*)(void *))func)(args[0].p);
break;
case 2:
- ((void (*)(void *, void *))func)(args[0], args[1]);
+ if (args_type[1] <= CMD_ARG_INTVAL) {
+ ((void (*)(void *, int))func)(args[0].p, args[1].n);
+ } else {
+ ((void (*)(void *, void *))func)(args[0].p, args[1].p);
+ }
break;
case 3:
- ((void (*)(void *, void *, void *))func)(args[0], args[1], args[2]);
+ ((void (*)(void *, void *, void *))func)(args[0].p, args[1].p,
args[2].p);
break;
case 4:
- ((void (*)(void *, void *, void *, void *))func)(args[0], args[1],
args[2], args[3]);
+ ((void (*)(void *, void *, void *, void *))func)(args[0].p, args[1].p,
args[2].p, args[3].p);
break;
case 5:
- ((void (*)(void *, void *, void *, void *, void *))func)(args[0],
args[1], args[2], args[3], args[4]);
+ ((void (*)(void *, void *, void *, void *, void *))func)(args[0].p,
args[1].p, args[2].p, args[3].p, args[4].p);
break;
default:
return;
@@ -3232,48 +3365,42 @@
char *completion, int completion_size,
char *history, int history_size)
{
- int type;
+ int tc, type;
const char *p;
p = *pp;
- type = *p;
- if (type == '\0')
- return 0;
+ type = 0;
+ if (*p == 'u') {
p++;
+ type = CMD_ARG_USE_ARGVAL;
+ }
+ if (*p == '\0')
+ return 0;
+ tc = *p++;
get_param(&p, prompt, prompt_size, '{', '}');
get_param(&p, completion, completion_size, '[', ']');
get_param(&p, history, history_size, '|', '|');
- switch (type) {
- case 'v':
- *argtype = CMD_ARG_INTVAL;
- break;
+ switch (tc) {
case 'i':
- *argtype = CMD_ARG_INT;
+ type |= CMD_ARG_INT;
+ break;
+ case 'v':
+ type |= CMD_ARG_INTVAL;
break;
case 's':
- *argtype = CMD_ARG_STRING;
+ type |= CMD_ARG_STRING;
break;
case 'S': /* used in define_kbd_macro, and mode selection */
- *argtype = CMD_ARG_STRINGVAL;
+ type |= CMD_ARG_STRINGVAL;
break;
default:
return -1;
}
*pp = p;
+ *argtype = type;
return 1;
}
-typedef struct ExecCmdState {
- EditState *s;
- CmdDef *d;
- int nb_args;
- int argval;
- const char *ptype;
- void *args[MAX_CMD_ARGS];
- unsigned char args_type[MAX_CMD_ARGS];
- char default_input[512]; /* default input if none given */
-} ExecCmdState;
-
static void arg_edit_cb(void *opaque, char *str);
static void parse_args(ExecCmdState *es);
static void free_cmd(ExecCmdState *es);
@@ -3302,8 +3429,8 @@
es->nb_args = 0;
/* first argument is always the window */
- es->args[es->nb_args] = (void *)s;
- es->args_type[es->nb_args] = CMD_ARG_WINDOW;
+ es->args[0].p = s;
+ es->args_type[0] = CMD_ARG_WINDOW;
es->nb_args++;
es->ptype = argdesc;
@@ -3320,7 +3447,7 @@
char completion_name[64];
char history[32];
unsigned char arg_type;
- int ret, rep_count, no_arg;
+ int ret, rep_count, get_arg, type, use_argval;
for (;;) {
ret = parse_arg(&es->ptype, &arg_type,
@@ -3333,31 +3460,42 @@
break;
if (es->nb_args >= MAX_CMD_ARGS)
goto fail;
- es->args_type[es->nb_args] = arg_type;
- no_arg = 0;
- switch (arg_type) {
+ use_argval = arg_type & CMD_ARG_USE_ARGVAL;
+ type = arg_type & CMD_ARG_TYPE_MASK;
+ es->args_type[es->nb_args] = type;
+ get_arg = 0;
+ switch (type) {
case CMD_ARG_INTVAL:
+ es->args[es->nb_args].n = (int)(intptr_t)d->val;
+ break;
case CMD_ARG_STRINGVAL:
- es->args[es->nb_args] = (void *)d->val;
+ es->args[es->nb_args].p = d->val;
break;
case CMD_ARG_INT:
- if (es->argval != NO_ARG) {
- es->args[es->nb_args] = (void *)es->argval;
+ if (use_argval && es->argval != NO_ARG) {
+ es->args[es->nb_args].n = es->argval;
es->argval = NO_ARG;
} else {
/* CG: Should add syntax for default value if no prompt */
- es->args[es->nb_args] = (void *)NO_ARG;
- no_arg = 1;
+ es->args[es->nb_args].n = NO_ARG;
+ get_arg = 1;
}
break;
case CMD_ARG_STRING:
- es->args[es->nb_args] = (void *)NULL;
- no_arg = 1;
+ if (use_argval && es->argval != NO_ARG) {
+ char buf[32];
+ snprintf(buf, sizeof(buf), "%d", es->argval);
+ es->args[es->nb_args].p = strdup(buf);
+ es->argval = NO_ARG;
+ } else {
+ es->args[es->nb_args].p = NULL;
+ get_arg = 1;
break;
}
+ }
es->nb_args++;
/* if no argument specified, try to ask it to the user */
- if (no_arg && prompt[0] != '\0') {
+ if (get_arg && prompt[0] != '\0') {
char def_input[1024];
/* XXX: currently, default input is handled non generically */
@@ -3365,7 +3503,8 @@
es->default_input[0] = '\0';
if (!strcmp(completion_name, "file")) {
get_default_path(s, def_input, sizeof(def_input));
- } else if (!strcmp(completion_name, "buffer")) {
+ } else
+ if (!strcmp(completion_name, "buffer")) {
EditBuffer *b;
if (d->action.func == (void *)do_switch_to_buffer)
b = predict_switch_to_buffer(s);
@@ -3386,7 +3525,7 @@
}
}
- /* all arguments are parsed : we can now execute the command */
+ /* all arguments are parsed: we can now execute the command */
/* argval is handled as repetition count if not taken as argument */
if (es->argval != NO_ARG && es->argval > 1) {
rep_count = es->argval;
@@ -3394,6 +3533,8 @@
rep_count = 1;
}
+ qs->this_cmd_func = d->action.func;
+
do {
/* special case for hex mode */
if (d->action.func != (void *)do_char) {
@@ -3413,7 +3554,7 @@
/* CG: Should follow qs->active_window ? */
} while (--rep_count > 0);
- qs->last_cmd_func = d->action.func;
+ qs->last_cmd_func = qs->this_cmd_func;
fail:
free_cmd(es);
}
@@ -3426,7 +3567,7 @@
for (i = 0;i < es->nb_args; i++) {
switch (es->args_type[i]) {
case CMD_ARG_STRING:
- free(es->args[i]);
+ free(es->args[i].p);
break;
}
}
@@ -3456,14 +3597,14 @@
put_status(NULL, "Invalid number");
goto fail;
}
- es->args[index] = (void *)val;
+ es->args[index].n = val;
break;
case CMD_ARG_STRING:
if (str[0] == '\0' && es->default_input[0] != '\0') {
free(str);
str = strdup(es->default_input);
}
- es->args[index] = (void *)str; /* will be freed at the of the command
*/
+ es->args[index].p = str; /* will be freed at the of the command */
break;
}
/* now we can parse the following arguments */
@@ -6543,7 +6684,7 @@
int err, line_num;
CmdDef *d;
int nb_args, c, sep, i, skip;
- void *args[MAX_CMD_ARGS];
+ CmdArg args[MAX_CMD_ARGS];
unsigned char args_type[MAX_CMD_ARGS];
f = fopen(filename, "r");
@@ -6645,13 +6786,10 @@
put_status(s, "Badly defined command '%s'", cmd);
goto fail;
}
- args_type[nb_args++] = arg_type;
+ args[nb_args].p = NULL;
+ args_type[nb_args++] = arg_type & CMD_ARG_TYPE_MASK;
}
- /* fill args to avoid problems if error */
- for (i = 0; i < nb_args; i++)
- args[i] = NULL;
-
if (!expect_token(&p, '('))
goto fail;
@@ -6662,11 +6800,13 @@
/* pseudo arguments: skip them */
switch (args_type[i]) {
case CMD_ARG_WINDOW:
- args[i] = (void *)s;
+ args[i].p = s;
continue;
case CMD_ARG_INTVAL:
+ args[i].n = (int)(intptr_t)d->val;
+ continue;
case CMD_ARG_STRINGVAL:
- args[i] = (void *)d->val;
+ args[i].p = d->val;
continue;
}
@@ -6681,7 +6821,7 @@
switch (args_type[i]) {
case CMD_ARG_INT:
- args[i] = (void *)(intptr_t)strtol(p, (char**)&q, 0);
+ args[i].n = strtol(p, (char**)&q, 0);
if (q == p) {
put_status(s, "Number expected for arg %d", i);
goto fail;
@@ -6690,6 +6830,7 @@
break;
case CMD_ARG_STRING:
if (*p != '\"') {
+ /* XXX: should convert number to string */
put_status(s, "String expected for arg %d", i);
goto fail;
}
@@ -6721,7 +6862,7 @@
goto fail;
}
p++;
- args[i] = (void *)strp;
+ args[i].p = strp;
strp = q + 1;
break;
}
@@ -6733,8 +6874,10 @@
goto fail;
}
+ qs->this_cmd_func = d->action.func;
qs->ec.function = d->name;
call_func(d->action.func, nb_args, args, args_type);
+ qs->last_cmd_func = qs->this_cmd_func;
if (qs->active_window)
s = qs->active_window;
continue;
Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- qe.h 9 Dec 2007 23:31:39 -0000 1.31
+++ qe.h 12 Dec 2007 02:51:05 -0000 1.32
@@ -182,7 +182,6 @@
}
void css_strtolower(char *buf, int buf_size);
-void set_color(unsigned int *buf, int len, int style);
int get_clock_ms(void);
@@ -294,6 +293,16 @@
return b;
}
+static inline int clamp(int a, int b, int c) {
+ if (a < b)
+ return b;
+ else
+ if (a > c)
+ return c;
+ else
+ return a;
+}
+
/* charset.c */
/* maximum number of bytes for a character in all the supported charsets */
@@ -974,7 +983,9 @@
int is_full_screen;
/* commands */
int flag_split_window_change_focus;
+ /* XXX: move these to ec */
void *last_cmd_func; /* last executed command function call */
+ void *this_cmd_func; /* current executing command */
/* keyboard macros */
int defining_macro;
unsigned short *macro_keys;
@@ -1011,6 +1022,23 @@
/* command definitions */
+enum CmdArgType {
+ CMD_ARG_INT = 0,
+ CMD_ARG_INTVAL,
+ CMD_ARG_STRING,
+ CMD_ARG_STRINGVAL,
+ CMD_ARG_WINDOW,
+ CMD_ARG_TYPE_MASK = 0x7f,
+ CMD_ARG_USE_ARGVAL = 0x80,
+};
+
+#define MAX_CMD_ARGS 5
+
+typedef union CmdArg {
+ void *p;
+ int n;
+} CmdArg;
+
typedef struct CmdDef {
unsigned short key; /* normal key */
unsigned short alt_key; /* alternate key */
@@ -1130,6 +1158,12 @@
return display_char_bidir(s, offset1, offset2, 0, ch);
}
+static inline void set_color(unsigned int *p, unsigned int *to, int style) {
+ style <<= STYLE_SHIFT;
+ while (p < to)
+ *p++ |= style;
+}
+
/* input.c */
#define INPUTMETHOD_NOMATCH (-1)
@@ -1266,13 +1300,18 @@
void text_scroll_up_down(EditState *s, int dir);
void text_write_char(EditState *s, int key);
void do_return(EditState *s);
-void do_backspace(EditState *s);
-void do_delete_char(EditState *s);
+void do_backspace(EditState *s, int argval);
+void do_delete_char(EditState *s, int argval);
void do_tab(EditState *s);
-void do_kill_region(EditState *s, int kill);
+void do_append_next_kill(EditState *s);
+void do_kill(EditState *s, int p1, int p2, int dir);
+void do_kill_region(EditState *s, int killtype);
+void do_kill_line(EditState *s, int dir);
+void do_kill_word(EditState *s, int dir);
void do_kill_buffer(EditState *s, const char *bufname1);
void text_move_bol(EditState *s);
void text_move_eol(EditState *s);
+void do_goto(EditState *s, const char *str, int unit);
void do_goto_line(EditState *s, int line);
void switch_to_buffer(EditState *s, EditBuffer *b);
void do_up_down(EditState *s, int dir);
@@ -1302,6 +1341,7 @@
int eb_start_paragraph(EditBuffer *b, int offset);
void do_backward_paragraph(EditState *s);
void do_forward_paragraph(EditState *s);
+void do_kill_paragraph(EditState *s, int dir);
void do_fill_paragraph(EditState *s);
void do_changecase_word(EditState *s, int up);
void do_changecase_region(EditState *s, int up);
@@ -1328,7 +1368,6 @@
void do_toggle_line_numbers(EditState *s);
void do_toggle_truncate_lines(EditState *s);
void do_word_wrap(EditState *s);
-void do_goto_char(EditState *s, int pos);
void do_count_lines(EditState *s);
void do_what_cursor_position(EditState *s);
void do_set_tab_width(EditState *s, int tab_width);
@@ -1344,8 +1383,7 @@
void do_toggle_mode_line(EditState *s);
void do_set_system_font(EditState *s, const char *qe_font_name,
const char *system_fonts);
-void call_func(void *func, int nb_args, void **args,
- unsigned char *args_type);
+void call_func(void *func, int nb_args, CmdArg *args, unsigned char
*args_type);
void exec_command(EditState *s, CmdDef *d, int argval);
void do_execute_command(EditState *s, const char *cmd, int argval);
void window_display(EditState *s);
Index: qeconfig.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qeconfig.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- qeconfig.h 6 Dec 2007 17:43:48 -0000 1.15
+++ qeconfig.h 12 Dec 2007 02:51:05 -0000 1.16
@@ -24,6 +24,7 @@
*/
static CmdDef basic_commands[] = {
CMDV( KEY_DEFAULT, KEY_NONE, "self-insert-command", do_char, ' ', "*v")
+ CMD_( KEY_META('#'), KEY_NONE, "insert-char", do_char, "*i{Insert char: }")
CMD_( KEY_CTRL('o'), KEY_NONE, "open-line", do_open_line, "*")
CMD1( KEY_CTRL('p'), KEY_UP, "previous-line", do_up_down, -1 )
CMD1( KEY_CTRL('n'), KEY_DOWN, "next-line", do_up_down, 1 )
@@ -40,14 +41,18 @@
CMD0( KEY_INSERT, KEY_NONE, "overwrite-mode", do_insert)
/* deletion commands are allowed in read only buffers,
* they will merely copy the data to the kill ring */
- CMD0( KEY_CTRL('d'), KEY_DELETE, "delete-char", do_delete_char)
- CMD0( 127, KEY_NONE, "backward-delete-char", do_backspace)
- CMD1( KEY_META(KEY_DEL) , KEY_META(KEY_BS),
- "backward-delete-word", do_delete_word, -1)
- CMD1( KEY_META('d') , KEY_NONE, "delete-word", do_delete_word, 1)
- CMD1( KEY_CTRL('k'), KEY_NONE, "kill-line", do_kill_region, 2 )
+ CMD_( KEY_CTRL('d'), KEY_DELETE, "delete-char", do_delete_char, "*ui")
+ CMD_( 127, KEY_NONE, "backward-delete-char", do_backspace, "*ui")
+ CMD0( KEY_META(KEY_CTRL('w')) , KEY_NONE,
+ "append-next-kill", do_append_next_kill)
+ CMDV( KEY_META(KEY_DEL) , KEY_META(KEY_BS),
+ "backward-kill-word", do_kill_word, -1, "*v" )
+ CMDV( KEY_META('d') , KEY_NONE, "kill-word", do_kill_word, 1, "*v" )
+ CMDV( KEY_CTRL('k'), KEY_NONE, "kill-line", do_kill_line, 1, "*v" )
+ CMDV( KEY_NONE, KEY_NONE,
+ "kill-beginning-of-line", do_kill_line, -1, "*v" )
CMD0( KEY_CTRL('@'), KEY_NONE, "set-mark-command", do_set_mark )
- CMD1( KEY_CTRL('w'), KEY_NONE, "kill-region", do_kill_region, 1 )
+ CMDV( KEY_CTRL('w'), KEY_NONE, "kill-region", do_kill_region, 1, "*v" )
CMD1( KEY_META('w'), KEY_NONE, "copy-region", do_kill_region, 0 )
CMD0( KEY_META('<'), KEY_CTRL_HOME, "beginning-of-buffer", do_bof )
CMD0( KEY_META('>'), KEY_CTRL_END, "end-of-buffer", do_eof )
@@ -90,15 +95,16 @@
CMD0( KEY_CTRLX('u'), KEY_CTRL('_'), "undo", do_undo)
CMD_( KEY_RET, KEY_NONE, "newline", do_return, "*")
CMD0( KEY_CTRL('l'), KEY_NONE, "refresh", do_refresh_complete)
- /* CG: should take a string if no numeric argument given */
- CMD_( KEY_META('g'), KEY_NONE, "goto-line", do_goto_line, "i{Goto line: }")
- CMD_( KEY_NONE, KEY_NONE, "goto-char", do_goto_char, "i{Goto char: }")
+
+ CMDV( KEY_META('g'), KEY_NONE, "goto-line", do_goto, 'l', "us{Goto line:
}v")
+ CMDV( KEY_CTRLX('g'), KEY_NONE, "goto-char", do_goto, 'c', "us{Goto char:
}v")
CMD0( KEY_CTRLX(KEY_CTRL('q')), KEY_NONE, "vc-toggle-read-only",
do_toggle_read_only)
CMD0( KEY_META('~'), KEY_NONE, "not-modified", do_not_modified)
CMD_( KEY_META('q'), KEY_NONE, "fill-paragraph", do_fill_paragraph, "*")
CMD0( KEY_META('{'), KEY_NONE, "backward-paragraph", do_backward_paragraph)
CMD0( KEY_META('}'), KEY_NONE, "forward-paragraph", do_forward_paragraph)
+ CMDV( KEY_NONE, KEY_NONE, "kill-paragraph", do_kill_paragraph, 1, "*v")
CMD0( KEY_CTRLX(KEY_CTRL('x')), KEY_NONE, "exchange-point-and-mark",
do_exchange_point_and_mark)
CMDV( KEY_META('l'), KEY_NONE, "downcase-word", do_changecase_word, 0,
"*v")
@@ -205,11 +211,11 @@
/* tab & indent */
CMD_( KEY_NONE, KEY_NONE, "set-tab-width", do_set_tab_width,
- "i{Tab width: }")
+ "ui{Tab width: }")
CMD_( KEY_NONE, KEY_NONE, "set-indent-width", do_set_indent_width,
- "i{Indent width: }")
+ "ui{Indent width: }")
CMD_( KEY_NONE, KEY_NONE, "set-indent-tabs-mode", do_set_indent_tabs_mode,
- "i{Indent tabs mode (0 or 1): }")
+ "ui{Indent tabs mode (0 or 1): }")
CMD_DEF_END,
};
Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- shell.c 10 Dec 2007 13:28:08 -0000 1.23
+++ shell.c 12 Dec 2007 02:51:05 -0000 1.24
@@ -1111,8 +1111,7 @@
}
/* launch shell */
- if (run_process(path, argv,
- &s->pty_fd, &s->pid) < 0) {
+ if (run_process(path, argv, &s->pty_fd, &s->pid) < 0) {
eb_free(b);
return NULL;
}
@@ -1237,17 +1236,17 @@
/* Should dispatch as in fundamental mode */
switch (c) {
case 4:
- do_delete_char(e);
+ do_delete_char(e, NO_ARG);
break;
// Do not do this: it is useless and causes infinite recursion
//case 9:
// do_tab(e);
// break;
case 11:
- do_kill_region(e, 2);
+ do_kill_line(e, 1);
break;
case 127:
- do_backspace(e);
+ do_backspace(e, NO_ARG);
break;
case '\r':
do_return(e);
Index: util.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/util.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- util.c 10 Dec 2007 13:28:08 -0000 1.21
+++ util.c 12 Dec 2007 02:51:05 -0000 1.22
@@ -840,15 +840,6 @@
}
}
-void set_color(unsigned int *buf, int len, int style)
-{
- int i;
-
- style <<= STYLE_SHIFT;
- for (i = 0; i < len; i++)
- buf[i] |= style;
-}
-
#ifdef __TINYC__
/* the glibc folks use wrappers, but forgot to put a compatibility
Index: xml.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/xml.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xml.c 6 Dec 2007 17:59:23 -0000 1.6
+++ xml.c 12 Dec 2007 02:51:05 -0000 1.7
@@ -76,7 +76,7 @@
p++;
}
}
- set_color(p_start, p - p_start, QE_STYLE_COMMENT);
+ set_color(p_start, p, QE_STYLE_COMMENT);
} else {
/* we are in a tag */
if (ustristart(p, "SCRIPT", (const unsigned int **)&p)) {
@@ -99,7 +99,7 @@
p++;
}
}
- set_color(p_start, p - p_start, QE_STYLE_TAG);
+ set_color(p_start, p, QE_STYLE_TAG);
if (state == XML_SCRIPT) {
/* javascript coloring */
p_start = p;
@@ -119,7 +119,7 @@
state &= ~XML_SCRIPT;
c_colorize_line(p_start, p - p_start, &state,
state_only);
state |= XML_SCRIPT;
- set_color(p, p1 - p, QE_STYLE_TAG);
+ set_color(p, p1, QE_STYLE_TAG);
p = p1;
state = 0;
break;
@@ -133,15 +133,15 @@
parse_style:
for (;;) {
if (*p == '\n') {
- set_color(p_start, p - p_start, QE_STYLE_CSS);
+ set_color(p_start, p, QE_STYLE_CSS);
break;
} else if (ustristart(p, "</STYLE", (const unsigned
int **)&p1)) {
while (*p1 != '\n' && *p1 != '>')
p1++;
if (*p1 == '>')
p1++;
- set_color(p_start, p - p_start, QE_STYLE_CSS);
- set_color(p, p1 - p, QE_STYLE_TAG);
+ set_color(p_start, p, QE_STYLE_CSS);
+ set_color(p, p1, QE_STYLE_TAG);
p = p1;
state = 0;
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs TODO clang.c hex.c latex-mode.c list.c q...,
Charlie Gordon <=