[asterisk-commits] eliel: branch 1.6.2 r184256 - in /branches/1.6.2: ./ main/asterisk.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 25 10:33:34 CDT 2009
Author: eliel
Date: Wed Mar 25 10:33:24 2009
New Revision: 184256
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=184256
Log:
Merged revisions 184220 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r184220 | eliel | 2009-03-25 10:38:19 -0400 (Wed, 25 Mar 2009) | 19 lines
Merged revisions 184188 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r184188 | eliel | 2009-03-25 10:12:54 -0400 (Wed, 25 Mar 2009) | 13 lines
Avoid destroying the CLI line when moving the cursor backward and trying to autocomplete.
When moving the cursor backward and pressing TAB to autocomplete, a NULL is put
in the line and we are loosing what we have already wrote after the actual
cursor position.
(closes issue #14373)
Reported by: eliel
Patches:
asterisk.c.patch uploaded by eliel (license 64)
Tested by: lmadsen
........
................
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/main/asterisk.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Wed Mar 25 10:33:24 2009
@@ -1,1 +1,1 @@
-/trunk:1-182359,182408,182450,182525,182530,182553,182722,182847,183028,183057,183108,183117,183242,183244,183321,183511,183560,183701,183766,183865,183914,184037,184043,184079,184147,184151,184219
+/trunk:1-182359,182408,182450,182525,182530,182553,182722,182847,183028,183057,183108,183117,183242,183244,183321,183511,183560,183701,183766,183865,183914,184037,184043,184079,184147,184151,184219-184220
Modified: branches/1.6.2/main/asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.2/main/asterisk.c?view=diff&rev=184256&r1=184255&r2=184256
==============================================================================
--- branches/1.6.2/main/asterisk.c (original)
+++ branches/1.6.2/main/asterisk.c Wed Mar 25 10:33:24 2009
@@ -2398,11 +2398,12 @@
int nummatches = 0;
char **matches;
int retval = CC_ERROR;
- char buf[2048];
+ char buf[2048], savechr;
int res;
LineInfo *lf = (LineInfo *)el_line(editline);
+ savechr = *(char *)lf->cursor;
*(char *)lf->cursor = '\0';
ptr = (char *)lf->cursor;
if (ptr) {
@@ -2428,8 +2429,10 @@
char *mbuf;
int mlen = 0, maxmbuf = 2048;
/* Start with a 2048 byte buffer */
- if (!(mbuf = ast_malloc(maxmbuf)))
+ if (!(mbuf = ast_malloc(maxmbuf))) {
+ lf->cursor[0] = savechr;
return (char *)(CC_ERROR);
+ }
snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr);
fdsend(ast_consock, buf);
res = 0;
@@ -2438,8 +2441,10 @@
if (mlen + 1024 > maxmbuf) {
/* Every step increment buffer 1024 bytes */
maxmbuf += 1024;
- if (!(mbuf = ast_realloc(mbuf, maxmbuf)))
+ if (!(mbuf = ast_realloc(mbuf, maxmbuf))) {
+ lf->cursor[0] = savechr;
return (char *)(CC_ERROR);
+ }
}
/* Only read 1024 bytes at a time */
res = read(ast_consock, mbuf + mlen, 1024);
@@ -2498,6 +2503,8 @@
ast_free(matches[i]);
ast_free(matches);
}
+
+ lf->cursor[0] = savechr;
return (char *)(long)retval;
}
More information about the asterisk-commits
mailing list