*** empty log message ***
authorpcg <pcg>
Mon, 15 Mar 2004 00:08:11 +0000 (00:08 +0000)
committerpcg <pcg>
Mon, 15 Mar 2004 00:08:11 +0000 (00:08 +0000)
src/command.C
src/defaultfont.C
src/main.C
src/rxvt.h
src/screen.C
src/table/jis0208_1983_0.h

index b2b816eae74d8e1aae0e4cb57559c4c51de825c9..c55a0e2fb61bd3d67920d86ab9f673edae0d9dd3 100644 (file)
@@ -761,7 +761,7 @@ bool
 rxvt_term::cmd_parse ()
 {
   bool flag = false;
-  uint32_t ch = NOCHAR;
+  unicode_t ch = NOCHAR;
 
   for (;;)
     {
@@ -774,10 +774,10 @@ rxvt_term::cmd_parse ()
       if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r')
         {
           /* Read a text string from the input buffer */
-          uint32_t buf[BUFSIZ];
+          unicode_t buf[BUFSIZ];
           bool refreshnow = false;
           int nlines = 0;
-          uint32_t *str = buf;
+          unicode_t *str = buf;
 
           *str++ = ch;
 
@@ -865,7 +865,7 @@ rxvt_term::cmd_parse ()
 
 // read the next character, currently handles UTF-8
 // will probably handle all sorts of other stuff in the future
-uint32_t
+unicode_t
 rxvt_term::next_char ()
 {
   while (cmdbuf_ptr < cmdbuf_endp)
@@ -901,12 +901,12 @@ rxvt_term::next_char ()
  * Return the next input character after first passing any keyboard input
  * to the command.
  */
-uint32_t
+unicode_t
 rxvt_term::cmd_getc ()
 {
   for (;;)
     {
-      uint32_t c = next_char ();
+      unicode_t c = next_char ();
       if (c != NOCHAR)
         return c;
 
@@ -2333,7 +2333,7 @@ rxvt_term::process_escape_seq ()
         /* 8.3.87: NEXT LINE */
       case C1_NEL:             /* ESC E */
         {
-          uint32_t nlcr[] = { '\n', '\r' };
+          unicode_t nlcr[] = { L'\n', L'\r' };
           scr_add_lines (nlcr, 1, 2);
         }
         break;
@@ -3128,19 +3128,32 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), u
 #ifdef scrollBar_esc
                   { scrollBar_esc, PrivMode_scrollBar },
 #endif
+                 // 18, 19 printing-related
                   { 25, PrivMode_VisibleCursor },
-                  { 35, PrivMode_ShiftKeys },
+                 // 30 show scrollbar rxvt. extension
+                  { 35, PrivMode_ShiftKeys }, // rxvt extension
                   { 40, PrivMode_132OK },
+                 // 41 xterm more fixes NYI
+                 // 45 margin bell NYI
+                 // 46 start logging
                   { 47, PrivMode_Screen },
                   { 66, PrivMode_aplKP },
 #ifndef NO_BACKSPACE_KEY
                   { 67, PrivMode_BackSpace },
 #endif
                   { 1000, PrivMode_MouseX11 },
-                  { 1010, PrivMode_TtyOutputInh },
-                  { 1011, PrivMode_Keypress },
+                 // 1001 Use Hilite Mouse Tracking. NYI, TODO
+                 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO
+                 // 1003 Use All Motion Mouse Tracking. NYI, TODO
+                  { 1010, PrivMode_TtyOutputInh }, // rxvt extension
+                  { 1011, PrivMode_Keypress }, // rxvt extension
+                 // 1035 enable modifiers for alt, numlock NYI
+                 // 1036 send ESC for meta keys NYI
+                 // 1037 send DEL for keypad delete NYI
                   { 1047, PrivMode_Screen },
+                 // 1048 save and restore cursor
                   { 1049, PrivMode_Screen }, /* xterm extension, not fully implemented */
+                 // 1051, 1052, 1060, 1061 keyboard emulation NYI
                 };
 
   if (nargs == 0)
@@ -3165,109 +3178,108 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), u
           }
 
       /* extra handling for values with state unkept  */
-      if (state == -1)
-        switch (arg[i])
-          {
-            case 1048:         /* alternative cursor save */
-              if (mode == 0)
-                scr_cursor (RESTORE);
-              else if (mode == 1)
-                scr_cursor (SAVE);
-              /* FALLTHROUGH */
-            default:
-              continue;        /* for (;i;) */
-          }
-
-      /* extra handling for values with valid 0 or 1 state */
       switch (arg[i])
         {
-            /* case 1: - application cursor keys */
-          case 2:                      /* VT52 mode */
-            /* oddball mode.  should be set regardless of set/reset
-             * parameter.  Return from VT52 mode with an ESC < from
-             * within VT52 mode
-             */
-            PrivMode (1, PrivMode_vt52);
-            break;
-          case 3:                      /* 80/132 */
-            if (PrivateModes & PrivMode_132OK)
-              set_widthheight (((state ? 132 : 80) * TermWin.fwidth), TermWin.height);
-            break;
-          case 4:                      /* smooth scrolling */
-            if (state)
-              Options &= ~Opt_jumpScroll;
-            else
-              Options |= Opt_jumpScroll;
-            break;
-          case 5:                      /* reverse video */
-            scr_rvideo_mode (state);
-            break;
-          case 6:                      /* relative/absolute origins  */
-            scr_relative_origin (state);
-            break;
-          case 7:                      /* autowrap */
-            scr_autowrap (state);
-            break;
-            /* case 8: - auto repeat, can't do on a per window basis */
-          case 9:                      /* X10 mouse reporting */
-            if (state)         /* orthogonal */
-              PrivateModes &= ~ (PrivMode_MouseX11);
-            break;
+          case 1048:           /* alternative cursor save */
+          case 1049:
+            if (mode == 0)
+              scr_cursor (RESTORE);
+            else if (mode == 1)
+              scr_cursor (SAVE);
+            /* FALLTHROUGH */
+        }
+
+      if (state >= 0)
+        /* extra handling for values with valid 0 or 1 state */
+        switch (arg[i])
+          {
+              /* case 1:       - application cursor keys */
+            case 2:                    /* VT52 mode */
+              /* oddball mode.  should be set regardless of set/reset
+               * parameter.  Return from VT52 mode with an ESC < from
+               * within VT52 mode
+               */
+              PrivMode (1, PrivMode_vt52);
+              break;
+            case 3:                    /* 80/132 */
+              if (PrivateModes & PrivMode_132OK)
+                set_widthheight (((state ? 132 : 80) * TermWin.fwidth), TermWin.height);
+              break;
+            case 4:                    /* smooth scrolling */
+              if (state)
+                Options &= ~Opt_jumpScroll;
+              else
+                Options |= Opt_jumpScroll;
+              break;
+            case 5:                    /* reverse video */
+              scr_rvideo_mode (state);
+              break;
+            case 6:                    /* relative/absolute origins  */
+              scr_relative_origin (state);
+              break;
+            case 7:                    /* autowrap */
+              scr_autowrap (state);
+              break;
+              /* case 8:       - auto repeat, can't do on a per window basis */
+            case 9:                    /* X10 mouse reporting */
+              if (state)               /* orthogonal */
+                PrivateModes &= ~ (PrivMode_MouseX11);
+              break;
 #ifdef menuBar_esc
-          case menuBar_esc:
+            case menuBar_esc:
 #ifdef MENUBAR
-            map_menuBar (state);
+              map_menuBar (state);
 #endif
-            break;
+              break;
 #endif
 #ifdef scrollBar_esc
-          case scrollBar_esc:
-            if (scrollbar_mapping (state))
-              {
-                resize_all_windows (0, 0, 0);
-                scr_touch (true);
-              }
-            break;
+            case scrollBar_esc:
+              if (scrollbar_mapping (state))
+                {
+                  resize_all_windows (0, 0, 0);
+                  scr_touch (true);
+                }
+              break;
 #endif
-          case 25:             /* visible/invisible cursor */
-            scr_cursor_visible (state);
-            break;
-            /* case 35:        - shift keys */
-            /* case 40:        - 80 <--> 132 mode */
-          case 47:             /* secondary screen */
-            scr_change_screen (state);
-            break;
-            /* case 66:        - application key pad */
-            /* case 67:        - backspace key */
-          case 1000:           /* X11 mouse reporting */
-            if (state)         /* orthogonal */
-              PrivateModes &= ~ (PrivMode_MouseX10);
-            break;
+            case 25:           /* visible/invisible cursor */
+              scr_cursor_visible (state);
+              break;
+              /* case 35:      - shift keys */
+              /* case 40:      - 80 <--> 132 mode */
+            case 47:           /* secondary screen */
+              scr_change_screen (state);
+              break;
+              /* case 66:      - application key pad */
+              /* case 67:      - backspace key */
+            case 1000:         /* X11 mouse reporting */
+              if (state)               /* orthogonal */
+                PrivateModes &= ~ (PrivMode_MouseX10);
+              break;
 #if 0
-          case 1001:
-            break;             /* X11 mouse highlighting */
+            case 1001:
+              break;           /* X11 mouse highlighting */
 #endif
-          case 1010:           /* scroll to bottom on TTY output inhibit */
-            if (state)
-              Options &= ~Opt_scrollTtyOutput;
-            else
-              Options |= Opt_scrollTtyOutput;
-            break;
-          case 1011:           /* scroll to bottom on key press */
-            if (state)
-              Options |= Opt_scrollTtyKeypress;
-            else
-              Options &= ~Opt_scrollTtyKeypress;
-            break;
-          case 1047:           /* secondary screen w/ clearing */
-          case 1049:           /* better secondary screen w/ clearing, but not fully implemented */
-            if (current_screen != PRIMARY)
-              scr_erase_screen (2);
-            scr_change_screen (state);
-            /* FALLTHROUGH */
-          default:
-            break;
-        }
+            case 1010:         /* scroll to bottom on TTY output inhibit */
+              if (state)
+                Options &= ~Opt_scrollTtyOutput;
+              else
+                Options |= Opt_scrollTtyOutput;
+              break;
+            case 1011:         /* scroll to bottom on key press */
+              if (state)
+                Options |= Opt_scrollTtyKeypress;
+              else
+                Options &= ~Opt_scrollTtyKeypress;
+              break;
+            case 1047:         /* secondary screen w/ clearing */
+            case 1049:         /* better secondary screen w/ clearing, but not fully implemented */
+              if (current_screen != PRIMARY)
+                scr_erase_screen (2);
+              scr_change_screen (state);
+              /* FALLTHROUGH */
+            default:
+              break;
+          }
     }
 }
 /*}}} */
@@ -3305,6 +3317,9 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 7:
             rendset = 1, rendstyle = RS_RVid;
             break;
+          case 8:
+            // invisible. NYI
+            break;
           case 22:
             rendset = 0, rendstyle = RS_Bold;
             break;
@@ -3317,7 +3332,11 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 27:
             rendset = 0, rendstyle = RS_RVid;
             break;
+          case 28:
+            // visible. NYI
+            break;
         }
+
       if (rendset != -1)
         {
           scr_rendition (rendset, rendstyle);
@@ -3334,15 +3353,13 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 35:
           case 36:
           case 37:
-            scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)),
-                       Color_fg);
+            scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg);
             break;
 #ifdef TTY_256COLOR
           case 38:
             if (nargs > i + 2 && arg[i + 1] == 5)
               {
-                scr_color ((unsigned int) (minCOLOR + arg[i + 2]),
-                           Color_fg);
+                scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg);
                 i += 2;
               }
             break;
@@ -3359,15 +3376,13 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 45:
           case 46:
           case 47:
-            scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)),
-                       Color_bg);
+            scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg);
             break;
 #ifdef TTY_256COLOR
           case 48:
             if (nargs > i + 2 && arg[i + 1] == 5)
               {
-                scr_color ((unsigned int) (minCOLOR + arg[i + 2]),
-                           Color_bg);
+                scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg);
                 i += 2;
               }
             break;
index e0183c6e521ad5ea0336dad1935fbadbed0cb22a..43610a531d0226b015a7ce15e244263baa900480 100644 (file)
@@ -275,7 +275,7 @@ struct rxvt_font_default : rxvt_font {
     return true;
   }
 
-  bool has_codepoint (uint32_t unicode)
+  bool has_codepoint (unicode_t unicode)
   {
     if (unicode <= 0x001f)
       return true;
@@ -406,7 +406,7 @@ struct rxvt_font_x11 : rxvt_font {
 
   bool load (const rxvt_fontprop &prop);
 
-  bool has_codepoint (uint32_t unicode);
+  bool has_codepoint (unicode_t unicode);
 
   void draw (rxvt_drawable &d, int x, int y,
              const text_t *text, int len,
@@ -663,7 +663,7 @@ rxvt_font_x11::clear ()
 }
 
 bool
-rxvt_font_x11::has_codepoint (uint32_t unicode)
+rxvt_font_x11::has_codepoint (unicode_t unicode)
 {
   uint32_t ch = FROM_UNICODE (cs, unicode);
 
@@ -815,7 +815,7 @@ struct rxvt_font_xft : rxvt_font {
              const text_t *text, int len,
              int fg, int bg);
 
-  bool has_codepoint (uint32_t unicode);
+  bool has_codepoint (unicode_t unicode);
 
 protected:
   XftFont *f;
@@ -938,7 +938,7 @@ rxvt_font_xft::load (const rxvt_fontprop &prop)
 }
 
 bool
-rxvt_font_xft::has_codepoint (uint32_t unicode)
+rxvt_font_xft::has_codepoint (unicode_t unicode)
 {
   return XftCharExists (DISPLAY, f, unicode);
 }
@@ -1151,7 +1151,7 @@ rxvt_fontset::populate (const char *desc)
 }
 
 int
-rxvt_fontset::find_font (uint32_t unicode)
+rxvt_fontset::find_font (unicode_t unicode)
 {
   for (unsigned int i = 0; i < fonts.size (); i++)
     {
index ec0f41e6a2d951ef31ce6e4079d088f3b52f8847..51487f63f97f62be1d3198c0a6e744c3a65c7e9f 100644 (file)
@@ -61,7 +61,7 @@ rxvt_set_locale (const char *locale)
 #if ENABLE_COMBINING
 class rxvt_composite_vec rxvt_composite;
 
-text_t rxvt_composite_vec::compose (uint32_t c1, uint32_t c2)
+text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2)
 {
   compose_char *cc;
   
@@ -97,7 +97,7 @@ text_t rxvt_composite_vec::compose (uint32_t c1, uint32_t c2)
   return v.size () - 1 + COMPOSE_LO;
 }
 
-int rxvt_composite_vec::expand (uint32_t c, wchar_t *r)
+int rxvt_composite_vec::expand (unicode_t c, wchar_t *r)
 {
   compose_char *cc = (*this)[c];
 
index a9d6d8b96ceb92b66daad2dcf41e1f07dfdeeec8..4aedf532f5d32ca7ac3e4a45b80d5dd68ca5c0da 100644 (file)
@@ -10,6 +10,7 @@
 #include <X11/keysymdef.h>
 #include <X11/Xatom.h>
 
+#include "encoding.h"
 #include "defaultfont.h"
 #include "rxvtcolor.h"
 #include "iom.h"
@@ -137,10 +138,6 @@ struct mouse_event {
  *****************************************************************************
  */
 
-#if defined (NO_OLD_SELECTION) && defined(NO_NEW_SELECTION)
-# error if you disable both selection styles, how can you select, silly?
-#endif
-
 /* COLORTERM, TERM environment variables */
 #define COLORTERMENV    "rxvt"
 #ifdef XPM_BACKGROUND
@@ -838,8 +835,8 @@ struct mbstate {
 // that are not representable in unicode, as well as characters
 // not fitting in the BMP.
 struct compose_char {
-  uint32_t c1, c2; // any chars != NOCHAR are valid
-  compose_char (uint32_t c1, uint32_t c2)
+  unicode_t c1, c2; // any chars != NOCHAR are valid
+  compose_char (unicode_t c1, unicode_t c2)
   : c1(c1), c2(c2)
   { }
 };
@@ -847,8 +844,8 @@ struct compose_char {
 class rxvt_composite_vec {
   vector<compose_char> v;
 public:
-  text_t compose (uint32_t c1, uint32_t c2 = NOCHAR);
-  int expand (uint32_t c, wchar_t *r);
+  text_t compose (unicode_t c1, unicode_t c2 = NOCHAR);
+  int expand (unicode_t c, wchar_t *r);
   compose_char *operator [](text_t c)
   {
     return c >= COMPOSE_LO && c < COMPOSE_LO + v.size ()
@@ -1130,7 +1127,7 @@ struct rxvt_term : rxvt_vars {
   bool init (int argc, const char *const *argv);
   bool init_vars ();
 
-  uint32_t next_char ();
+  unicode_t next_char ();
 
   bool pty_fill ();
 
@@ -1195,7 +1192,7 @@ struct rxvt_term : rxvt_vars {
   // command.C
   void lookup_key (XKeyEvent &ev);
   unsigned int cmd_write (const unsigned char *str, unsigned int count);
-  uint32_t cmd_getc ();
+  unicode_t cmd_getc ();
   bool cmd_parse ();
   void mouse_report (XButtonEvent &ev);
   void button_press (XButtonEvent &ev);
@@ -1277,7 +1274,7 @@ struct rxvt_term : rxvt_vars {
   int scr_change_screen (int scrn);
   void scr_color (unsigned int color, int fgbg);
   void scr_rendition (int set, int style);
-  void scr_add_lines (const uint32_t *str, int nlines, int len);
+  void scr_add_lines (const unicode_t *str, int nlines, int len);
   void scr_backspace ();
   void scr_tab (int count);
   void scr_backindex ();
index b00b3aff7535bb738e695c32ff4e3cfd924754fe..3745ca25939e9dc46840250b2d1d2623c09009e6 100644 (file)
@@ -764,10 +764,10 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec)
  * Add text given in <str> of length <len> to screen struct
  */
 void
-rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len)
+rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
 {
   unsigned char checksel, clearsel;
-  uint32_t c;
+  unicode_t c;
   int i, row, last_col;
   text_t *stp;
   rend_t *srp;
@@ -953,7 +953,7 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len)
             *tp = ' '; // hack //D //TODO //--tp, --rp;
 
           // first try to find a precomposed character
-          uint32_t n = rxvt_compose (*tp, c);
+          unicode_t n = rxvt_compose (*tp, c);
           if (n == NOCHAR)
             n = rxvt_composite.compose (*tp, c);
 
@@ -2859,16 +2859,9 @@ rxvt_term::selection_make (Time tm)
         new_selection_text[ofs++] = L'\n';
     }
 
-#ifndef NO_OLD_SELECTION
-  if (selection_style == OLD_SELECT)
-    if (end_col == TermWin.ncol)
-      new_selection_text[ofs++] = L'\n';
-#endif
-#ifndef NO_NEW_SELECTION
-  if (selection_style != OLD_SELECT)
-    if (end_col != selection.end.col)
-      new_selection_text[ofs++] = L'\n';
-#endif
+  if (end_col != selection.end.col)
+    new_selection_text[ofs++] = L'\n';
+
   new_selection_text[ofs] = 0;
 
   if (ofs == 0)
@@ -2937,16 +2930,22 @@ rxvt_term::selection_start_colrow (int col, int row)
   want_refresh = 1;
   selection.mark.col = col;
   selection.mark.row = row - TermWin.view_start;
+
   MAX_IT (selection.mark.row, - (int32_t)TermWin.nscrolled);
   MIN_IT (selection.mark.row, (int32_t)TermWin.nrow - 1);
   MAX_IT (selection.mark.col, 0);
   MIN_IT (selection.mark.col, (int32_t)TermWin.ncol - 1);
 
+  while (selection.mark.col > 0
+         && screen.text[selection.mark.row + TermWin.saveLines][selection.mark.col] == NOCHAR)
+    --selection.mark.col;
+  
   if (selection.op)
     {      /* clear the old selection */
       selection.beg.row = selection.end.row = selection.mark.row;
       selection.beg.col = selection.end.col = selection.mark.col;
     }
+
   selection.op = SELECTION_INIT;
   selection.screen = current_screen;
 }
@@ -2958,17 +2957,17 @@ rxvt_term::selection_start_colrow (int col, int row)
  */
 
 /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */
-#define DELIMIT_TEXT(x) \
-    (((x) == ' ' || (x) == '\t') ? 2 : (STRCHR (rs[Rs_cutchars], (x)) != NULL))
+#define DELIMIT_TEXT(x)                \
+    (unicode::is_space (x) ? 2 : (x) <= 0xff && !!STRCHR (rs[Rs_cutchars], (x)))
 #define DELIMIT_REND(x)        1
 
 void
 rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret)
 {
-  int             col, row, dirnadd, tcol, trow, w1, w2;
-  row_col_t       bound;
-  text_t         *stp;
-  rend_t         *srp;
+  int col, row, dirnadd, tcol, trow, w1, w2;
+  row_col_t bound;
+  text_t *stp;
+  rend_t *srp;
 
   if (dirn == UP)
     {
@@ -2982,6 +2981,7 @@ rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, r
       bound.col = TermWin.ncol - 1;
       dirnadd = 1;
     }
+
   row = mark->row + TermWin.saveLines;
   col = mark->col;
   MAX_IT (col, 0);
@@ -2989,17 +2989,6 @@ rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, r
   stp = & (screen.text[row][col]);
   w1 = DELIMIT_TEXT (*stp);
 
-  if (selection_style != NEW_SELECT)
-    {
-      if (w1 == 1)
-        {
-          stp += dirnadd;
-          if (DELIMIT_TEXT (*stp) == 1)
-            goto Old_Word_Selection_You_Die;
-          col += dirnadd;
-        }
-      w1 = 0;
-    }
   srp = (&screen.rend[row][col]);
   w2 = DELIMIT_REND (*srp);
 
@@ -3008,24 +2997,33 @@ rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, r
       for (; col != bound.col; col += dirnadd)
         {
           stp += dirnadd;
+          srp += dirnadd;
+
+          if (*stp == NOCHAR)
+            continue;
+
           if (DELIMIT_TEXT (*stp) != w1)
             break;
-          srp += dirnadd;
           if (DELIMIT_REND (*srp) != w2)
             break;
         }
+
       if ((col == bound.col) && (row != bound.row))
         {
           if (screen.tlen[ (row - (dirn == UP ? 1 : 0))] == -1)
             {
               trow = row + dirnadd;
               tcol = dirn == UP ? TermWin.ncol - 1 : 0;
+
               if (screen.text[trow] == NULL)
                 break;
+
               stp = & (screen.text[trow][tcol]);
               srp = & (screen.rend[trow][tcol]);
+
               if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2)
                 break;
+
               row = trow;
               col = tcol;
               continue;
@@ -3033,6 +3031,7 @@ rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, r
         }
       break;
     }
+
 Old_Word_Selection_You_Die:
   D_SELECT ((stderr, "rxvt_selection_delimit_word (%s,...) @ (r:%3d, c:%3d) has boundary (r:%3d, c:%3d)", (dirn == UP ? "up     " : "down"), mark->row, mark->col, row - TermWin.saveLines, col));
 
@@ -3064,29 +3063,25 @@ rxvt_term::selection_extend (int x, int y, int flag)
   MAX_IT (col, 0);
   MIN_IT (col, (int)TermWin.ncol);
 
-#ifndef NO_NEW_SELECTION
   /*
   * If we're selecting characters (single click) then we must check first
   * if we are at the same place as the original mark.  If we are then
   * select nothing.  Otherwise, if we're to the right of the mark, you have to
   * be _past_ a character for it to be selected.
   */
-  if (selection_style != OLD_SELECT)
-    {
-      if (((selection.clicks % 3) == 1) && !flag
-          && (col == selection.mark.col
-              && (row == selection.mark.row + TermWin.view_start)))
-        {
-          /* select nothing */
-          selection.beg.row = selection.end.row = 0;
-          selection.beg.col = selection.end.col = 0;
-          selection.clicks = 4;
-          want_refresh = 1;
-          D_SELECT ((stderr, "rxvt_selection_extend () selection.clicks = 4"));
-          return;
-        }
+  if (((selection.clicks % 3) == 1) && !flag
+      && (col == selection.mark.col
+          && (row == selection.mark.row + TermWin.view_start)))
+    {
+      /* select nothing */
+      selection.beg.row = selection.end.row = 0;
+      selection.beg.col = selection.end.col = 0;
+      selection.clicks = 4;
+      want_refresh = 1;
+      D_SELECT ((stderr, "rxvt_selection_extend () selection.clicks = 4"));
+      return;
     }
-#endif
+
   if (selection.clicks == 4)
     selection.clicks = 1;
 
@@ -3150,67 +3145,6 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
 
   pos.row -= TermWin.view_start;   /* adjust for scroll */
 
-#ifndef NO_OLD_SELECTION
-  /*
-   * This mimics some of the selection behaviour of version 2.20 and before.
-   * There are no ``selection modes'', button3 is always character extension.
-   * Note: button3 drag is always available, c.f. v2.20
-   * Selection always terminates (left or right as appropriate) at the mark.
-   */
-  if (selection_style == OLD_SELECT)
-    {
-      if (selection.clicks == 1 || button3)
-        {
-          if (hate_those_clicks)
-            {
-              hate_those_clicks = 0;
-              if (selection.clicks == 1)
-                {
-                  selection.beg.row = selection.mark.row;
-                  selection.beg.col = selection.mark.col;
-                }
-              else
-                {
-                  selection.mark.row = selection.beg.row;
-                  selection.mark.col = selection.beg.col;
-                }
-            }
-          if (ROWCOL_IS_BEFORE (pos, selection.mark))
-            {
-              selection.end.row = selection.mark.row;
-              selection.end.col = selection.mark.col + 1;
-              selection.beg.row = pos.row;
-              selection.beg.col = pos.col;
-            }
-          else
-            {
-              selection.beg.row = selection.mark.row;
-              selection.beg.col = selection.mark.col;
-              selection.end.row = pos.row;
-              selection.end.col = pos.col + 1;
-            }
-        }
-      else if (selection.clicks == 2)
-        {
-          selection_delimit_word (UP, & (selection.mark),
-                                  & (selection.beg));
-          selection_delimit_word (DN, & (selection.mark),
-                                  & (selection.end));
-          hate_those_clicks = 1;
-        }
-      else if (selection.clicks == 3)
-        {
-          selection.beg.row = selection.end.row = selection.mark.row;
-          selection.beg.col = 0;
-          selection.end.col = ncol;
-          hate_those_clicks = 1;
-        }
-      D_SELECT ((stderr, "rxvt_selection_extend_colrow () EXIT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col));
-      return;
-    }
-#endif                          /* ! NO_OLD_SELECTION */
-#ifndef NO_NEW_SELECTION
-  /* selection_style must not be OLD_SELECT to get here */
   /*
    * This is mainly xterm style selection with a couple of differences, mainly
    * in the way button3 drag extension works.
@@ -3225,7 +3159,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
    *     time of the most recent button3 press
    */
   if (button3 && buttonpress)
-    {       /* button3 press */
+    { /* button3 press */
       /*
        * first determine which edge of the selection we are closest to
        */
@@ -3236,13 +3170,13 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
                   < ((selection.end.col - pos.col)
                      + ((selection.end.row - pos.row) * ncol)))))
         closeto = LEFT;
+
       if (closeto == LEFT)
         {
           selection.beg.row = pos.row;
           selection.beg.col = pos.col;
           selection.mark.row = selection.end.row;
-          selection.mark.col = selection.end.col
-                               - (selection.clicks == 2);
+          selection.mark.col = selection.end.col - (selection.clicks == 2);
         }
       else
         {
@@ -3253,18 +3187,18 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
         }
     }
   else
-    {                    /* button1 drag or button3 drag */
+    { /* button1 drag or button3 drag */
       if (ROWCOL_IS_AFTER (selection.mark, pos))
         {
           if ((selection.mark.row == selection.end.row)
               && (selection.mark.col == selection.end.col)
               && clickchange && selection.clicks == 2)
             selection.mark.col--;
+
           selection.beg.row = pos.row;
           selection.beg.col = pos.col;
           selection.end.row = selection.mark.row;
-          selection.end.col = selection.mark.col
-                              + (selection.clicks == 2);
+          selection.end.col = selection.mark.col + (selection.clicks == 2);
         }
       else
         {
@@ -3278,6 +3212,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
   if (selection.clicks == 1)
     {
       end_col = screen.tlen[selection.beg.row + TermWin.saveLines];
+
       if (end_col != -1 && selection.beg.col > end_col)
         {
 #if 1
@@ -3288,37 +3223,35 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
           else
             selection.beg.col = selection.mark.col;
 #endif
-
         }
+
       end_col = screen.tlen[selection.end.row + TermWin.saveLines];
+
       if (end_col != -1 && selection.end.col > end_col)
         selection.end.col = ncol;
-
     }
   else if (selection.clicks == 2)
     {
       if (ROWCOL_IS_AFTER (selection.end, selection.beg))
         selection.end.col--;
-      selection_delimit_word (UP, & (selection.beg),
-                              & (selection.beg));
-      selection_delimit_word (DN, & (selection.end),
-                              & (selection.end));
+
+      selection_delimit_word (UP, & (selection.beg), & (selection.beg));
+      selection_delimit_word (DN, & (selection.end), & (selection.end));
     }
   else if (selection.clicks == 3)
     {
 #ifndef NO_FRILLS
       if ((Options & Opt_tripleclickwords))
         {
-          int             end_row;
-
-          selection_delimit_word (UP, & (selection.beg),
-                                  & (selection.beg));
-          end_row = screen.tlen[selection.mark.row
-                                + TermWin.saveLines];
-          for (end_row = selection.mark.row; end_row < TermWin.nrow;
-               end_row++)
+          int end_row;
+
+          selection_delimit_word (UP, & (selection.beg), & (selection.beg));
+          end_row = screen.tlen[selection.mark.row + TermWin.saveLines];
+
+          for (end_row = selection.mark.row; end_row < TermWin.nrow; end_row++)
             {
               end_col = screen.tlen[end_row + TermWin.saveLines];
+
               if (end_col != -1)
                 {
                   selection.end.row = end_row;
@@ -3330,7 +3263,6 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
         }
       else
 #endif
-
         {
           if (ROWCOL_IS_AFTER (selection.mark, selection.beg))
             selection.mark.col++;
@@ -3338,8 +3270,9 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
           selection.end.col = ncol;
         }
     }
+
   if (button3 && buttonpress)
-    {       /* mark may need to be changed */
+    { /* mark may need to be changed */
       if (closeto == LEFT)
         {
           selection.mark.row = selection.end.row;
@@ -3353,7 +3286,6 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
         }
     }
   D_SELECT ((stderr, "rxvt_selection_extend_colrow () EXIT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col));
-#endif                          /* ! NO_NEW_SELECTION */
 }
 
 #ifndef NO_FRILLS
index 9d47237be24499385548f4e07cf5fce5060b4cd2..1f3b704a7e113551cbe3a68f82ae9ade0545f9db 100644 (file)
@@ -2900,7 +2900,7 @@ static const uint16_t jis0208_1983_0_t_m[] = {
 };
 
 struct rxvt_codeset_conv_jis0208_1983_0 : rxvt_codeset_conv {
-  uint32_t from_unicode (uint32_t unicode) const {
+  uint32_t from_unicode (unicode_t unicode) const {
     if (unicode == 0x2312) return 0x225e;
     uint8_t  l = unicode;
     uint16_t h = unicode >> 8;
@@ -2912,7 +2912,7 @@ struct rxvt_codeset_conv_jis0208_1983_0 : rxvt_codeset_conv {
              : NOCHAR;
     return NOCHAR;
   }
-  uint32_t to_unicode (uint32_t enc) const {
+  unicode_t to_unicode (uint32_t enc) const {
     if (enc <= 0x2421 && 0x2473 <= enc) return enc + 0x0c20;
     if (enc <= 0x2521 && 0x2576 <= enc) return enc + 0x0b80;
     uint8_t  l = enc;