From: handa Date: Tue, 8 Nov 2005 12:48:32 +0000 (+0000) Subject: (delete_char): Fix the case of deleting the previous X-Git-Tag: REL-1-3-0~85 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6893b58753b476ff79e8aed5ebe73e5e42b89c43;p=m17n%2Fm17n-lib.git (delete_char): Fix the case of deleting the previous multiple characters. (surrounding_text_handler): Check number characters to delete. --- diff --git a/example/medit.c b/example/medit.c index 6465fd8..df7c7ba 100644 --- a/example/medit.c +++ b/example/medit.c @@ -950,6 +950,8 @@ delete_char (int n) from = cursor.from, to = from + n; else { + from = cursor.from + n; + to = cursor.from; if (cursor.from == cur.from) { /* We are at the beginning of line. */ @@ -963,13 +965,6 @@ delete_char (int n) reseat (info.line_from); } update_cursor (pos, 1); - from = cursor.from; - to = cursor.to; - } - else - { - from = cursor.from - 1; - to = cursor.from; } } @@ -2204,8 +2199,18 @@ surrounding_text_handler (MInputContext *ic, MSymbol command) { int len = (int) mplist_value (ic->plist); - if (len != 0) - delete_char (len); + if (len < 0) + { + if (corsor.from + len < 0) + len = - corsor.from; + delete_char (len); + } + else if (len > 0) + { + if (corsor.from + len > nchars) + len = nchars - corsor.from; + delete_char (len); + } } }