comparison src/reditor.c @ 12:f0f9a028aa7c

*** empty log message ***
author shinobu
date Sat, 30 Aug 2008 21:30:44 +0900
parents bb64d8561b7b
children 1e44fe6dcfaa
comparison
equal deleted inserted replaced
11:bb64d8561b7b 12:f0f9a028aa7c
1491 rep->cursession = cursn; 1491 rep->cursession = cursn;
1492 } 1492 }
1493 1493
1494 text = get_memline_wrp(cursn->buf, cursn->prevline); 1494 text = get_memline_wrp(cursn->buf, cursn->prevline);
1495 1495
1496 cmd = make_cmd(REP_REPLACE_CMD, cursn->sid, rep->eid, rep->seqno++, cursn->prevline, text); 1496 //cmd = make_cmd(REP_REPLACE_CMD, cursn->sid, rep->eid, rep->seqno++, cursn->prevline, text);
1497
1498 // TODO : 変更前のテキストを UNDO バッファから取得する
1499 cmd = make_cmd(REP_DELETE_CMD, cursn->sid, rep->eid, rep->seqno++, cursn->prevline, prev_text);
1500 cmd->next = make_cmd(REP_INSERT_CMD, cursn->sid, rep->eid, rep->seqno++, cursn->prevline, text);
1497 1501
1498 add_cmd_to_list(&(cursn->new_cmdlist), cmd); 1502 add_cmd_to_list(&(cursn->new_cmdlist), cmd);
1499 1503
1500 1504
1501 1505
1658 1662
1659 if (rep->eid == 0) { 1663 if (rep->eid == 0) {
1660 rep->eid = eid; 1664 rep->eid = eid;
1661 } 1665 }
1662 break; 1666 break;
1667 /*
1663 case REP_SELECT_ACK: 1668 case REP_SELECT_ACK:
1664 // text is error message. means occur ERROR in session manager 1669 // text is error message. means occur ERROR in session manager
1665 if (text) { 1670 if (text) {
1666 e_msg_wrp(text); 1671 e_msg_wrp(text);
1667 return FALSE; 1672 return FALSE;
1682 1687
1683 set_cursession(session); 1688 set_cursession(session);
1684 1689
1685 rep_start_create_cmds(); 1690 rep_start_create_cmds();
1686 1691
1687 /* get window size */ 1692 // get window size
1688 /* send read command */ 1693 // send read command
1689 break; 1694 break;
1690 case REP_REGISTER_ACK: 1695 case REP_REGISTER_ACK:
1696 */
1691 case REP_PUT_ACK: 1697 case REP_PUT_ACK:
1692 /* Enter Session */ 1698 /* Enter Session */
1693 1699
1694 if (text) { // text is error message. 1700 if (text) { // text is error message.
1695 e_msg_wrp(text); 1701 e_msg_wrp(text);
1709 /* set session to cursession */ 1715 /* set session to cursession */
1710 set_cursession(session); 1716 set_cursession(session);
1711 rep_start_create_cmds(); 1717 rep_start_create_cmds();
1712 1718
1713 break; 1719 break;
1720 /*
1714 case REP_DEREGISTER_CMD: 1721 case REP_DEREGISTER_CMD:
1715 case REP_DEREGISTER_ACK: 1722 case REP_DEREGISTER_ACK:
1716 case REP_QUIT_CMD: 1723 case REP_QUIT_CMD:
1717 case REP_QUIT_ACK: 1724 case REP_QUIT_ACK:
1718 case REP_GET_CMD: 1725 case REP_GET_CMD:
1719 case REP_GET_ACK: 1726 case REP_GET_ACK:
1720 break; 1727 break;
1721 case REP_OPEN_CMD: 1728 case REP_OPEN_CMD:
1722 /* REP_OPEN_CMD is handled in list part. (may be upper function) */ 1729 // REP_OPEN_CMD is handled in list part. (may be upper function)
1723 break; 1730 break;
1724
1725 /* connection commands */
1726 1731
1727 case REP_OPEN_ACK: 1732 case REP_OPEN_ACK:
1728 case REP_CLOSE_CMD: 1733 case REP_CLOSE_CMD:
1729 break; 1734 break;
1730 case REP_CLOSE_ACK: 1735 case REP_CLOSE_ACK:
1733 break; 1738 break;
1734 case REP_READ_ACK: 1739 case REP_READ_ACK:
1735 break; 1740 break;
1736 case REP_READ_FIN: 1741 case REP_READ_FIN:
1737 break; 1742 break;
1738 /* buffer edit commands */ 1743 // buffer edit commands
1739 /* session's buffer is set to current buffer */ 1744 // session's buffer is set to current buffer
1745 */
1740 case REP_INSERT_CMD: 1746 case REP_INSERT_CMD:
1741 append_memline_wrp(lnum, text); 1747 append_memline_wrp(lnum, text);
1742 break; 1748 break;
1743 case REP_DELETE_LINE_CMD: 1749 case REP_DELETE_LINE_CMD:
1744 delete_memline_wrp(lnum); 1750 delete_memline_wrp(lnum);
1745 break; 1751 break;
1752 /*
1746 case REP_REPLACE_CMD: 1753 case REP_REPLACE_CMD:
1747 if (lnum > get_bufmaxline_wrp(session->buf)) { 1754 if (lnum > get_bufmaxline_wrp(session->buf)) {
1748 append_memline_wrp(lnum, text); 1755 append_memline_wrp(lnum, text);
1749 } 1756 }
1750 replace_memline_wrp(lnum, text); /* text was allocated */ 1757 replace_memline_wrp(lnum, text); // text was allocated
1751 break; 1758 break;
1759 */
1752 default: 1760 default:
1753 break; 1761 break;
1754 } 1762 }
1755 1763
1756 free_cmdlist(&(tmplist)); 1764 free_cmdlist(&(tmplist));
2058 close(rep_p->smfd); 2066 close(rep_p->smfd);
2059 rep_p->smfd = -1; 2067 rep_p->smfd = -1;
2060 return FALSE; 2068 return FALSE;
2061 } 2069 }
2062 /* Session ごとに行う↓*/ 2070 /* Session ごとに行う↓*/
2071 /*
2063 for(sn = rep_p->shead; sn ; sn = sn->next) { 2072 for(sn = rep_p->shead; sn ; sn = sn->next) {
2064 translate( &sn->new_cmdlist , &txtcmdlist); 2073 translate( &sn->new_cmdlist , &txtcmdlist);
2065 } 2074 }
2075 */
2066 del_ignored_cmd(&txtcmdlist); 2076 del_ignored_cmd(&txtcmdlist);
2067 rep_exe_pktlist(&txtcmdlist); 2077 rep_exe_pktlist(&txtcmdlist);
2068 2078
2069 if (rep_send_cmds(rep_p->smfd, &(txtcmdlist)) == FALSE) { 2079 if (rep_send_cmds(rep_p->smfd, &(txtcmdlist)) == FALSE) {
2070 close(sn->smfd); 2080 close(sn->smfd);