Bugzilla – Attachment 47148 Details for
Bug 104867
GPM fails to insert non-ASCII characters properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
patch to allow copy and paste of latin1
linux-2.6.13-gpm-utf-8.patch (text/plain), 2.91 KB, created by
Michal Marek
on 2005-08-23 10:22:40 UTC
(
hide
)
Description:
patch to allow copy and paste of latin1
Filename:
MIME Type:
Creator:
Michal Marek
Created:
2005-08-23 10:22:40 UTC
Size:
2.91 KB
patch
obsolete
>This is just a hack to allow copy-n-paste of non-ASCII latin1 characters >in an UTF-8 console. > >written by mmarek@suse.cz > >--- linux-2.6.13-rc6-git7-3.orig/drivers/char/consolemap.c 2005-06-17 21:48:29.000000000 +0200 >+++ linux-2.6.13-rc6-git7-3/drivers/char/consolemap.c 2005-08-23 11:42:51.000000000 +0200 >@@ -221,16 +221,31 @@ > * was active, or using Unicode. > * Still, it is now possible to a certain extent to cut and paste non-ASCII. > */ >-unsigned char inverse_translate(struct vc_data *conp, int glyph) >+u16 inverse_translate(struct vc_data *conp, int glyph) > { > struct uni_pagedir *p; > if (glyph < 0 || glyph >= MAX_GLYPH) > return 0; >- else if (!(p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc) || >- !p->inverse_translations[inv_translate[conp->vc_num]]) >- return glyph; >- else >- return p->inverse_translations[inv_translate[conp->vc_num]][glyph]; >+ if (conp->vc_utf) { >+ /* hack: works probably only w/ latin1 */ >+ if (glyph < 0x80) { >+ return glyph; >+ } else if (glyph < 0x0100) { >+ unsigned char hi, lo; >+ hi = (glyph >> 6) | 0xc0; >+ lo = (glyph & 0x3f) | 0x80; >+ return hi << 8 | lo; >+ } else { >+ printk(KERN_DEBUG "inverse_translate: unknown glyph %04X\n", glyph); >+ return '?'; >+ } >+ } else { >+ if (!(p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc) || >+ !p->inverse_translations[inv_translate[conp->vc_num]]) >+ return glyph; >+ else >+ return p->inverse_translations[inv_translate[conp->vc_num]][glyph]; >+ } > } > > static void update_user_maps(void) >--- linux-2.6.13-rc6-git7-3.orig/drivers/char/selection.c 2005-06-17 21:48:29.000000000 +0200 >+++ linux-2.6.13-rc6-git7-3/drivers/char/selection.c 2005-08-23 11:43:29.000000000 +0200 >@@ -54,7 +54,7 @@ > complement_pos(sel_cons, where); > } > >-static unsigned char >+static u16 > sel_pos(int n) > { > return inverse_translate(sel_cons, screen_glyph(sel_cons, n)); >@@ -240,7 +240,7 @@ > sel_end = new_sel_end; > > /* Allocate a new buffer before freeing the old one ... */ >- bp = kmalloc((sel_end-sel_start)/2+1, GFP_KERNEL); >+ bp = kmalloc((sel_end-sel_start)+1, GFP_KERNEL); > if (!bp) { > printk(KERN_WARNING "selection: kmalloc() failed\n"); > clear_selection(); >@@ -252,7 +252,13 @@ > > obp = bp; > for (i = sel_start; i <= sel_end; i += 2) { >- *bp = sel_pos(i); >+ u16 utf = sel_pos(i); >+ if (!(utf & 0xff00)) { >+ *bp = utf & 0x00ff; >+ } else { >+ *bp++ = utf >> 8; >+ *bp = utf & 0x00ff; >+ } > if (!isspace(*bp++)) > obp = bp; > if (! ((i + 2) % vc->vc_size_row)) { >--- linux-2.6.13-rc6-git7-3.orig/include/linux/consolemap.h 2005-06-17 21:48:29.000000000 +0200 >+++ linux-2.6.13-rc6-git7-3/include/linux/consolemap.h 2005-08-23 11:34:49.000000000 +0200 >@@ -10,6 +10,6 @@ > > struct vc_data; > >-extern unsigned char inverse_translate(struct vc_data *conp, int glyph); >+extern u16 inverse_translate(struct vc_data *conp, int glyph); > extern unsigned short *set_translate(int m, struct vc_data *vc); > extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 104867
: 47148