File: widechar.patch

package info (click to toggle)
libcurses-ui-perl 0.9609-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,312 kB
  • sloc: perl: 12,464; makefile: 2
file content (376 lines) | stat: -rw-r--r-- 14,394 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
Author: Andreas Tille <tille@debian.org>
Last-Update: 2025-06-14
Bug-Debian: https://bugs.debian.org/755055
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=94539
Description: wide character support
 Following the advise given at CPAN https://rt.cpan.org/Public/Bug/Display.html?id=94539

--- a/lib/Curses/UI/Common.pm
+++ b/lib/Curses/UI/Common.pm
@@ -279,13 +279,13 @@ sub text_draw($$;)
 		$this->{-canvasscr}->hline( $y, $x, $type, $scrlen );
 		$x += $scrlen;
 	    } else {
-                $this->{-canvasscr}->addstr($y, $x, $token);
+                $this->{-canvasscr}->addstring($y, $x, $token);
                 $x += length($token);
             }
         }
     }
     else {
-        $this->{-canvasscr}->addstr($y, $x, $text);
+        $this->{-canvasscr}->addstring($y, $x, $text);
     }
 }
 
@@ -434,7 +434,7 @@ sub char_read(;$)
 	print STDERR "DEBUG: get_key() -> select() -> $!\n"
 	    if $Curses::UI::debug; 
     } elsif ($found) {
-	$key = $s->getch();
+	$key = $s->getchar();
     }
 
     return $key;
--- a/lib/Curses/UI.pm
+++ b/lib/Curses/UI.pm
@@ -497,7 +497,7 @@ sub draw()
     {
         my $s = $self->{-canvasscr};
         $s->clear;
-        $s->addstr(0, 0, $self->lang->get('screen_too_small'));
+        $s->addstring(0, 0, $self->lang->get('screen_too_small'));
         $s->move(4,0);
         $s->noutrefresh();
 	doupdate();
@@ -817,7 +817,7 @@ sub fatalerror($$;$)
 
     my $s = $self->{-canvasscr};
     $s->clear;
-    $s->addstr(0,0,"Fatal program error:\n"
+    $s->addstring(0,0,"Fatal program error:\n"
     	     . "-"x($ENV{COLS}-1) . "\n"
     	     . $error 
     	     . "-"x($ENV{COLS}-1) . "\n"
--- a/lib/Curses/UI/Buttonbox.pm
+++ b/lib/Curses/UI/Buttonbox.pm
@@ -337,7 +337,7 @@ sub draw(;$)
         }
  
         # Draw the button.
-        $this->{-canvasscr}->addstr(
+        $this->{-canvasscr}->addstring(
             $y, $this->{-xpos} + $x, 
             $button->{-label}
         );    
--- a/lib/Curses/UI/Calendar.pm
+++ b/lib/Curses/UI/Calendar.pm
@@ -266,14 +266,14 @@ sub draw(;$)
     # Draw day, month and year. If the widget has focus,
     # show the cursor position. Else show the selected position.
     my $c = $this->{-focus} ? 'c' : '';    
-    $this->{-canvasscr}->addstr(0,0," "x$this->canvaswidth);
-    $this->{-canvasscr}->addstr(0,0, $months[$this->{"-${c}month"}] 
+    $this->{-canvasscr}->addstring(0,0," "x$this->canvaswidth);
+    $this->{-canvasscr}->addstring(0,0, $months[$this->{"-${c}month"}] 
                     . " " . $this->{"-${c}day"});
-    $this->{-canvasscr}->addstr(0,$this->canvaswidth-4,$this->{"-${c}year"});
+    $this->{-canvasscr}->addstring(0,$this->canvaswidth-4,$this->{"-${c}year"});
 
     # Draw daynames
     $this->{-canvasscr}->attron(A_BOLD) if $this->{-focus};
-    $this->{-canvasscr}->addstr(2,0,join " ", @days);
+    $this->{-canvasscr}->addstring(2,0,join " ", @days);
 
     # Reset bold font attribute.
     $this->{-canvasscr}->attroff(A_BOLD) if $this->{-focus};
@@ -313,7 +313,7 @@ sub draw(;$)
 	       $this->{-cyear}  == $year;
 
         # Draw the day.
-        $this->{-canvasscr}->addstr($y, $weekday*3, sprintf("%2d",$day));
+        $this->{-canvasscr}->addstring($y, $weekday*3, sprintf("%2d",$day));
 
         # Reset attributes.
         $this->{-canvasscr}->attroff(A_REVERSE);
--- a/lib/Curses/UI/Checkbox.pm
+++ b/lib/Curses/UI/Checkbox.pm
@@ -217,8 +217,8 @@ sub draw(;$) {
     }
 
     $this->{-canvasscr}->attron(A_BOLD) if $this->{-focus};    
-    $this->{-canvasscr}->addstr(0, 0, '[ ]');
-    $this->{-canvasscr}->addstr(0, 1, 'X') if $this->{-checked};
+    $this->{-canvasscr}->addstring(0, 0, '[ ]');
+    $this->{-canvasscr}->addstring(0, 1, 'X') if $this->{-checked};
     $this->{-canvasscr}->attroff(A_BOLD) if $this->{-focus};    
 
     $this->{-canvasscr}->move(0,1);
--- a/lib/Curses/UI/Dialog/Error.pm
+++ b/lib/Curses/UI/Dialog/Error.pm
@@ -66,10 +66,10 @@ sub draw(;$)
     $this->SUPER::draw(1) or return $this;
 
     # Draw sign
-    $this->{-borderscr}->addstr(2, 1, "    _"); 
-    $this->{-borderscr}->addstr(3, 1, "   / \\"); 
-    $this->{-borderscr}->addstr(4, 1, "  / ! \\"); 
-    $this->{-borderscr}->addstr(5, 1, " /_____\\"); 
+    $this->{-borderscr}->addstring(2, 1, "    _"); 
+    $this->{-borderscr}->addstring(3, 1, "   / \\"); 
+    $this->{-borderscr}->addstring(4, 1, "  / ! \\"); 
+    $this->{-borderscr}->addstring(5, 1, " /_____\\"); 
     $this->{-borderscr}->noutrefresh();
 
     $this->{-canvasscr}->noutrefresh();
--- a/lib/Curses/UI/Label.pm
+++ b/lib/Curses/UI/Label.pm
@@ -209,11 +209,11 @@ sub draw(;$)
             $line = substr($line, 0, $this->canvaswidth);
             $line =~ s/.$/\$/;
         } elsif ($this->{-paddingspaces}) {
-            $this->{-canvasscr}->addstr($ypos, 0, " "x$this->canvaswidth);
+            $this->{-canvasscr}->addstring($ypos, 0, " "x$this->canvaswidth);
         }
 
         my $xpos = $this->compute_xpos($line);
-        $this->{-canvasscr}->addstr($ypos, $xpos, $line);
+        $this->{-canvasscr}->addstring($ypos, $xpos, $line);
 
         $ypos++;
     }
--- a/lib/Curses/UI/Listbox.pm
+++ b/lib/Curses/UI/Listbox.pm
@@ -340,7 +340,7 @@ sub draw(;$)
     if (not @{$this->{-values}})
     {
         $this->{-canvasscr}->attron(A_DIM);    
-        $this->{-canvasscr}->addstr(0,0,'- no values -');
+        $this->{-canvasscr}->addstring(0,0,'- no values -');
         $this->{-canvasscr}->attroff(A_DIM);    
 
     # There are values. Show them!
@@ -388,7 +388,7 @@ sub draw(;$)
             }
             
             # Make full line reverse or blank
-            $this->{-canvasscr}->addstr(
+            $this->{-canvasscr}->addstring(
                 $y, $prefix_len, 
                 " "x($this->canvaswidth-$prefix_len)
             );
@@ -404,9 +404,9 @@ sub draw(;$)
             if ($this->{-multi}) {
                 if (defined $this->{-selected} and    
                     $this->{-selected}->{$i}) {
-		    $this->{-canvasscr}->addstr($y, 0, '[X]');
+		    $this->{-canvasscr}->addstring($y, 0, '[X]');
                 } else {
-                    $this->{-canvasscr}->addstr($y, 0, '[ ]');
+                    $this->{-canvasscr}->addstring($y, 0, '[ ]');
                 }
             }
 
@@ -414,9 +414,9 @@ sub draw(;$)
             elsif ($this->{-radio}) {
                 if (defined $this->{-selected} 
                     and $i == $this->{-selected}) {
-                    $this->{-canvasscr}->addstr($y, 0, '<o>');
+                    $this->{-canvasscr}->addstring($y, 0, '<o>');
                 } else {
-                    $this->{-canvasscr}->addstr($y, 0, '< >');
+                    $this->{-canvasscr}->addstring($y, 0, '< >');
                 }
             }
             $this->{-canvasscr}->attroff(A_BOLD) if $this->{-focus};
--- a/lib/Curses/UI/Menubar.pm
+++ b/lib/Curses/UI/Menubar.pm
@@ -420,7 +420,7 @@ sub draw()
 	$this->{-canvasscr}->attron(COLOR_PAIR($pair));
     }
  
-    $this->{-canvasscr}->addstr(0, 0, " "x$this->canvaswidth);
+    $this->{-canvasscr}->addstring(0, 0, " "x$this->canvaswidth);
 
     # Create menu-items.
     my $x = 1;
@@ -447,7 +447,7 @@ sub draw()
         }
 
         my $label = $item->{-label};
-        $this->{-canvasscr}->addstr(0, $x, " " . $item->{-label} . " ");
+        $this->{-canvasscr}->addstring(0, $x, " " . $item->{-label} . " ");
         $x += length($label) + 2;
 
         $idx++;
--- a/lib/Curses/UI/Notebook.pm
+++ b/lib/Curses/UI/Notebook.pm
@@ -350,7 +350,7 @@ sub draw($;$) {
 
         debug_msg "    writing page name at x=$x";
         $page_win->attron(A_REVERSE) if ($page eq $active_page);
-        $page_win->addstr($y, $x, $page);
+        $page_win->addstring($y, $x, $page);
         $page_win->attroff(A_REVERSE) if ($page eq $active_page);
         if ($this->{-border} or $this->{-sbborder}) {
             for (my $i = 0; $i < length($page); $i++) {
--- a/lib/Curses/UI/Popupmenu.pm
+++ b/lib/Curses/UI/Popupmenu.pm
@@ -245,8 +245,8 @@ sub draw(;$)
         $sellabel = "-"x$width;
     }
 
-    $this->{-canvasscr}->addstr(0,0, " "x$width);
-    $this->{-canvasscr}->addstr(0,0, $sellabel);
+    $this->{-canvasscr}->addstring(0,0, " "x$width);
+    $this->{-canvasscr}->addstring(0,0, $sellabel);
     $this->{-canvasscr}->move(0,$this->canvaswidth-1);
     $this->{-canvasscr}->attroff(A_DIM);
     $this->{-canvasscr}->attroff(A_REVERSE);
--- a/lib/Curses/UI/Progressbar.pm
+++ b/lib/Curses/UI/Progressbar.pm
@@ -121,12 +121,12 @@ sub draw(;$)
 	$this->{-pos} != $this->{-max}) { $blocks-- }
 
     # Draw center line
-    $this->{-canvasscr}->addstr(0, 0, "-"x$this->canvaswidth)
+    $this->{-canvasscr}->addstring(0, 0, "-"x$this->canvaswidth)
         unless $this->{-nocenterline};
 
     # Draw blocks.
     $this->{-canvasscr}->attron(A_REVERSE);
-    $this->{-canvasscr}->addstr(0, 0, " "x$blocks);
+    $this->{-canvasscr}->addstring(0, 0, " "x$blocks);
     $this->{-canvasscr}->attroff(A_REVERSE);
 
     # Draw percentage
@@ -147,9 +147,9 @@ sub draw(;$)
         my $rev = substr($str, 0, $revlen);
         my $norev = substr($str, $revlen, $len-$revlen);
         $this->{-canvasscr}->attron(A_REVERSE);
-        $this->{-canvasscr}->addstr(0, $xpos, $rev);
+        $this->{-canvasscr}->addstring(0, $xpos, $rev);
         $this->{-canvasscr}->attroff(A_REVERSE);
-        $this->{-canvasscr}->addstr(0, $xpos+$revlen, $norev);
+        $this->{-canvasscr}->addstring(0, $xpos+$revlen, $norev);
     }
 
     $this->{-canvasscr}->move(0,$this->canvaswidth-1);
--- a/lib/Curses/UI/TextEditor.pm
+++ b/lib/Curses/UI/TextEditor.pm
@@ -461,7 +461,7 @@ sub draw_text(;$)
         $this->{-canvasscr}->attron(A_UNDERLINE) if ($this->{-showlines});;
         $this->{-canvasscr}->attron(A_REVERSE) if ($this->{-reverse});
         for my $y (0..$this->canvasheight-1) {
-            $this->{-canvasscr}->addstr($y, 0, " "x($this->canvaswidth));
+            $this->{-canvasscr}->addstring($y, 0, " "x($this->canvaswidth));
         }
     }
 
@@ -515,7 +515,7 @@ sub draw_text(;$)
             }
 
             # Clear line.
-            $this->{-canvasscr}->addstr(
+            $this->{-canvasscr}->addstring(
                 $id, 0, 
 		" "x$this->canvaswidth
 	    );
@@ -525,7 +525,7 @@ sub draw_text(;$)
             if ($inscreen =~ /\n/)
             {
                 $inscreen =~ s/\n//;
-                $this->{-canvasscr}->addstr($id, 0, $inscreen);
+                $this->{-canvasscr}->addstring($id, 0, $inscreen);
                 if ($this->{-showhardreturns})
                 {
                     if ($this->root->compat)
@@ -538,7 +538,7 @@ sub draw_text(;$)
                     }
                 }
             } else {
-                $this->{-canvasscr}->addstr($id, 0, $inscreen);
+                $this->{-canvasscr}->addstring($id, 0, $inscreen);
             }
             
             # Draw overflow characters.
--- a/lib/Curses/UI/Widget.pm
+++ b/lib/Curses/UI/Widget.pm
@@ -567,8 +567,8 @@ sub draw(;$)
         for my $y (0 .. $this->{-sh}-1)
         {
             my $rel_y = $y + $this->{-sy} - $this->{-by};
-            $this->{-borderscr}->addstr($rel_y, 0, '[');
-            $this->{-borderscr}->addstr($rel_y, $this->{-bw}-$offset, ']');
+            $this->{-borderscr}->addstring($rel_y, 0, '[');
+            $this->{-borderscr}->addstring($rel_y, $this->{-bw}-$offset, ']');
         }
         $this->{-borderscr}->attroff(A_BOLD) if $this->{-focus};
         }
@@ -602,7 +602,7 @@ sub draw(;$)
             if ($this->{-titlefullwidth} 
                 and $this->{-titlereverse}) {
             	$this->{-borderscr}->attron(A_BOLD); 
-                $this->{-borderscr}->addstr(0, 1, " "x($this->{-bw}-2));
+                $this->{-borderscr}->addstring(0, 1, " "x($this->{-bw}-2));
                 $this->{-borderscr}->attroff(A_BOLD);
             }
             my $t = $this->{-title};
@@ -613,7 +613,7 @@ sub draw(;$)
                 $t =~ s/.$/\$/;
             }
             $this->{-borderscr}->attron(A_BOLD);   
-            $this->{-borderscr}->addstr(0, 1, " $t ");
+            $this->{-borderscr}->addstring(0, 1, " $t ");
             $this->{-borderscr}->attroff(A_REVERSE);
             $this->{-borderscr}->attroff(A_BOLD);   
         }
@@ -1849,7 +1849,7 @@ new(), layout(), draw() and focus(), it
         $this->SUPER::draw(1);
 
         ....your own draw stuff....
-        $this->{-canvasscr}->addstr(0, 0, "Fixed string");
+        $this->{-canvasscr}->addstring(0, 0, "Fixed string");
         ....your own draw stuff....
 
         $this->{-canvasscr}->noutrefresh;
--- a/t/fakelib/Curses.pm
+++ b/t/fakelib/Curses.pm
@@ -25,7 +25,7 @@ sub new      {
 
 sub DESTROY  { }
 
-sub printw   { addstr(sprintf shift, @_) }
+sub printw   { addstring(sprintf shift, @_) }
 
 $LINES = 25;
 $COLS = 80;
@@ -40,12 +40,12 @@ $COLOR_PAIRS = "";
     LINES $LINES COLS $COLS stdscr $stdscr curscr $curscr COLORS $COLORS
     COLOR_PAIRS $COLOR_PAIRS
 
-    addch echochar addchstr addchnstr addstr addnstr attroff attron attrset
+    addch echochar addchstr addchnstr addstring addnstr attroff attron attrset
     standend standout attr_get attr_off attr_on attr_set chgat COLOR_PAIR
     PAIR_NUMBER beep flash bkgd bkgdset getbkgd border box hline vline
     erase clear clrtobot clrtoeol start_color init_pair init_color
     has_colors can_change_color color_content pair_content delch deleteln
-    insdelln insertln getch ungetch has_key KEY_F getstr getnstr getyx
+    insdelln insertln getchar ungetch has_key KEY_F getstr getnstr getyx
     getparyx getbegyx getmaxyx inch inchstr inchnstr initscr endwin
     isendwin newterm set_term delscreen cbreak nocbreak echo noecho
     halfdelay intrflush keypad meta nodelay notimeout raw noraw qiflush
@@ -161,11 +161,11 @@ sub getbegxy{ $_[1] = 1; $_[2] = 2; }
 sub getbegyx{ $_[1] = 1; $_[2] = 2; }
 sub getmaxyx{ $_[1] = 24; $_[2] = 80; }
 
-sub getch{
+sub getchar{
 # ok, I got a problem here ... mess with the internals
     my $badboy = caller();
     no strict 'refs';
-    #    print STDERR "getch called for $badboy\n";
+    #    print STDERR "getchar called for $badboy\n";
     *{$badboy . "::get_key"} = sub(;$) { 
 	$foo = rand 2; #there is a deep dispute in curses UI
 	               #about if get_key returns a string or