Mercurial > hg > RemoteEditor > vim7
changeset 31:8d4ffb7c9f4e
*** empty log message ***
author | kono |
---|---|
date | Tue, 28 Oct 2008 10:06:24 +0900 |
parents | bf9fabc0ae84 |
children | 7d0d8b831f5a |
files | src/REPNOTE.txt src/reditor.c |
diffstat | 2 files changed, 43 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/REPNOTE.txt Tue Oct 28 01:42:44 2008 +0900 +++ b/src/REPNOTE.txt Tue Oct 28 10:06:24 2008 +0900 @@ -1,3 +1,10 @@ +Tue Oct 28 09:57:29 JST 2008 + +utf-8 encoding でないと動作しないので、それをチェックした方が良い。 + +session は不要。session 毎に channelを開ける(現状では)必要があるので、 +rep_T を切替える方が良いらしい。 + Tue Oct 28 01:28:47 JST 2008 まぁ、一応、それっぽくはなって来たかな。 @@ -25,6 +32,7 @@ Mon Oct 27 15:53:19 JST 2008 直せば直すほど、動かなくなってくる。joinのsessionが変らしい。 + Done: read がでたらめだった... Sun Oct 26 21:45:49 JST 2008
--- a/src/reditor.c Tue Oct 28 01:42:44 2008 +0900 +++ b/src/reditor.c Tue Oct 28 10:06:24 2008 +0900 @@ -962,6 +962,33 @@ } +static int +rep_sync() +{ + Session *cursn; + rep_T *rep = get_rep(); + if ((cursn = rep->cursession) == NULL) return 0; + if (rep->syncMode!=0) { + char *text = get_memline_wrp(cursn->buf, rep->syncMode); + unsigned int length = strlen(text); + rep_cmd *cmd = make_cmd(REPCMD_DELETE, cursn->sid, rep->eid, + rep->seqno++, + rep->syncMode, length,text); + rep_send_cmd(rep->smfd,cmd); + // reuse cmd + // save current line for next replace + set_cmd_seq(cmd,REPCMD_INSERT,rep->seqno++); + rep_send_cmd(rep->smfd,cmd); + free_cmd(cmd); + if (rep->syncMode < get_bufmaxline_wrp(cursn->buf)) { + rep->syncMode++; + } else { + rep->syncMode=0; + } + return 1; + } + return 0; +} static int set_header(data, pkt, offset) @@ -1264,6 +1291,7 @@ rep_cmdlist txtcmdlist = {NULL,0}; rep_p = get_rep(); + rep_sync(); if ((rep_p->smfd > 0) && (FD_ISSET(rep_p->smfd, rfds_p))) { if (rep_recv_cmds(rep_p->smfd, &(txtcmdlist)) == FALSE) { close(rep_p->smfd); @@ -1329,6 +1357,7 @@ struct timeval zerotime; zerotime.tv_sec = 0; zerotime.tv_usec = 0; + struct timeval *timeout; if (fd < 0) return FALSE; @@ -1342,9 +1371,14 @@ FD_SET(fd,&rfds_p); + if (rep_sync()) { + timeout = &zerotime; + } else { + timeout = 0; + } max_fds = rep_fd_set(&rfds_p, &efds_p, max_fds); - if ((sk = select(max_fds+1, &rfds_p, NULL, &efds_p, NULL)) < 0) { + if ((sk = select(max_fds+1, &rfds_p, NULL, &efds_p, timeout)) < 0) { if (errno == EBADF){ int i; for(i = 0;i < max_fds;i++){