[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs buffer.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs buffer.c |
Date: |
Sat, 30 Nov 2013 13:50:13 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 13/11/30 13:50:13
Modified files:
. : buffer.c
Log message:
- fixed potential bug in eb_next_line for offset < 0.
- make it return '\n' and set offset to 0, similar to behavior at EOB
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.45&r2=1.46
Patches:
Index: buffer.c
===================================================================
RCS file: /sources/qemacs/qemacs/buffer.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- buffer.c 23 Nov 2013 19:11:13 -0000 1.45
+++ buffer.c 30 Nov 2013 13:50:12 -0000 1.46
@@ -2,7 +2,7 @@
* Buffer handling for QEmacs
*
* Copyright (c) 2000 Fabrice Bellard.
- * Copyright (c) 2002-2008 Charlie Gordon.
+ * Copyright (c) 2002-2013 Charlie Gordon.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -905,11 +905,13 @@
u8 buf[MAX_CHAR_BYTES];
int ch;
- if (offset >= b->total_size) {
- offset = b->total_size;
+ if (eb_read(b, offset, buf, 1) <= 0) {
ch = '\n';
+ if (offset < 0)
+ offset = 0;
+ if (offset >= b->total_size)
+ offset = b->total_size;
} else {
- eb_read(b, offset, buf, 1);
/* we use the charset conversion table directly to go faster */
ch = b->charset_state.table[buf[0]];
offset++;
@@ -1605,6 +1607,7 @@
int eb_next_line(EditBuffer *b, int offset)
{
int c;
+
for (;;) {
c = eb_nextc(b, offset, &offset);
if (c == '\n')
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs buffer.c,
Charlie Gordon <=