On Sun, Apr 14, 2013 at 3:39 PM, <zharik@xxxxxx> wrote: > + if (charset != NULL) { > + // UTF8 id assumed equal to -1 > + const uint32 idUTF8 = -1; Hey, I like this change overall but this line is giving me a compiler error because you cannot set a uint32 to a negative value. I'm not sure why it compiled for you, maybe you're on gcc4? John Scipione On Sun, Apr 14, 2013 at 3:39 PM, <zharik@xxxxxx> wrote: > hrev45500 adds 3 changesets to branch 'master' > old head: d52ffca978487d12ef5c08accea5dd442f0b931f > new head: a6ea4a194f34649fd0153e41a27284cc9cae3983 > overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=a6ea4a1+%5Ed52ffca > > ---------------------------------------------------------------------------- > > 1f8d927: Make Windows-1250 encoding consistent with other > > In sake of consistency with other Windows CP encodings: > * print_name is expanded to "Windows Central European (CP 1250)"; > * B_MS_WINDOWS_1250_CONVERSION id looks like should be added into UTF8.h; > * mime_name set to NULL as other windows codepages have. That prevents > at least from duplicating too much 1250's in the Terminal, Mail and > StyledEdit encodings menus. > > f8668ab: Improve File Encoding StatusView cell. (Fixes #9653) > > * Encoding cell of the StyledEdit StatusView is visible now only in case > the currently opened file encoding is not equal to default UTF-8 one; > * The Encodings menu that was opened by click on this cell is removed; > * Cmd-Opt-PgDn/PgUp shortcuts are added for quick iteration through the > list of encodings. > > a6ea4a1: Fix "Error opening terminal:xterm-256color" issue (#9636) > > Looks like switching to declare "xterm-256color" terminal emulation was > made a bit early: there are lot of servers that still do not know about > this terminal. As was discussed in #9636 the only acceptable way is to > switch back to "xterm" and adjust corresponding entry in our local > termcap database to support 256 colors. So this changeset: > > * Declare emulated terminal as "xterm"; > * Change the colors and color pairs of "xterm" termcap entry to support > 256 colors; > > Workarounds the #9636. Should be upgraded to "xterm-256color" some time > in the future. > > [ Siarzhuk Zharski <zharik@xxxxxx> ] > > ---------------------------------------------------------------------------- > > 7 files changed, 45 insertions(+), 24 deletions(-) > headers/os/support/UTF8.h | 3 ++- > src/apps/stylededit/StatusView.cpp | 14 +++++------- > src/apps/stylededit/StyledEditWindow.cpp | 32 +++++++++++++++++++++++----- > src/apps/stylededit/StyledEditWindow.h | 4 ++-- > src/apps/terminal/Shell.cpp | 2 +- > src/kits/textencoding/character_sets.cpp | 11 +++++----- > src/libs/termcap/termcap.src | 3 ++- > > ############################################################################ > > Commit: 1f8d9272512962516f02f5b13d368f6fda130032 > URL: http://cgit.haiku-os.org/haiku/commit/?id=1f8d927 > Author: Siarzhuk Zharski <zharik@xxxxxx> > Date: Sun Apr 14 10:34:10 2013 UTC > > Make Windows-1250 encoding consistent with other > > In sake of consistency with other Windows CP encodings: > * print_name is expanded to "Windows Central European (CP 1250)"; > * B_MS_WINDOWS_1250_CONVERSION id looks like should be added into UTF8.h; > * mime_name set to NULL as other windows codepages have. That prevents > at least from duplicating too much 1250's in the Terminal, Mail and > StyledEdit encodings menus. > > ---------------------------------------------------------------------------- > > diff --git a/headers/os/support/UTF8.h b/headers/os/support/UTF8.h > index c411d2b..ab5416a 100644 > --- a/headers/os/support/UTF8.h > +++ b/headers/os/support/UTF8.h > @@ -39,7 +39,8 @@ enum { > B_ISO15_CONVERSION, > B_BIG5_CONVERSION, // Chinese Big5 > B_GBK_CONVERSION, // Chinese GB18030 > - B_UTF16_CONVERSION // Unicode UTF-16 > + B_UTF16_CONVERSION, // Unicode UTF-16 > + B_MS_WINDOWS_1250_CONVERSION // Windows Central European Codepage > }; > > > diff --git a/src/kits/textencoding/character_sets.cpp > b/src/kits/textencoding/character_sets.cpp > index 1eab4ac..ac72fd2 100644 > --- a/src/kits/textencoding/character_sets.cpp > +++ b/src/kits/textencoding/character_sets.cpp > @@ -207,8 +207,8 @@ static const char * windows1251aliases[] = { > "cp1251", "cp5347", "ansi-1251", > NULL > }; > -static const BCharacterSet windows1251(18,2251, B_TRANSLATE("Windows > Cyrillic (CP 1251)"), > - "windows-1251",NULL,windows1251aliases); > +static const BCharacterSet windows1251(18,2251, B_TRANSLATE("Windows > Cyrillic " > + "(CP 1251)"), "windows-1251",NULL,windows1251aliases); > > static const char * IBM866aliases[] = { > // IANA aliases > @@ -238,7 +238,8 @@ static const char * eucKRaliases[] = { > // IANA aliases > "csEUCKR", > // java aliases > - "ksc5601", "euckr", "ks_c_5601-1987", "ksc5601-1987", "ksc5601_1987", > "ksc_5601", "5601", > + "ksc5601", "euckr", "ks_c_5601-1987", "ksc5601-1987", > + "ksc5601_1987", "ksc_5601", "5601", > NULL > }; > static const BCharacterSet eucKR(21,38, B_TRANSLATE("EUC Korean"), > @@ -311,8 +312,8 @@ static const char* kWindows1250Aliases[] = { > "ms-ee", > NULL > }; > -static const BCharacterSet kWindows1250(28, 2250, B_TRANSLATE("Windows-1250 " > - "(CP-1250)"), "windows-1250", "Windows-1250", kWindows1250Aliases); > +static const BCharacterSet kWindows1250(28, 2250, B_TRANSLATE("Windows > Central " > + "European (CP 1250)"), "windows-1250", NULL, kWindows1250Aliases); > > /** > * The following initializes the global character set array. > > ############################################################################ > > Commit: f8668ab42f2b09cdd3f7fe4964fe5485b2960dc2 > URL: http://cgit.haiku-os.org/haiku/commit/?id=f8668ab > Author: Siarzhuk Zharski <zharik@xxxxxx> > Date: Sun Apr 14 10:55:46 2013 UTC > > Ticket: https://dev.haiku-os.org/ticket/9653 > > Improve File Encoding StatusView cell. (Fixes #9653) > > * Encoding cell of the StyledEdit StatusView is visible now only in case > the currently opened file encoding is not equal to default UTF-8 one; > * The Encodings menu that was opened by click on this cell is removed; > * Cmd-Opt-PgDn/PgUp shortcuts are added for quick iteration through the > list of encodings. > > ---------------------------------------------------------------------------- > > diff --git a/src/apps/stylededit/StatusView.cpp > b/src/apps/stylededit/StatusView.cpp > index a6bdfcc..ea29c26 100644 > --- a/src/apps/stylededit/StatusView.cpp > +++ b/src/apps/stylededit/StatusView.cpp > @@ -26,7 +26,6 @@ > #include <Window.h> > > #include "Constants.h" > -#include "StyledEditWindow.h" > > > const float kHorzSpacing = 5.f; > @@ -159,7 +158,8 @@ StatusView::MouseDown(BPoint where) > if (!fReadOnly) > return; > > - if (where.x < fCellWidth[kPositionCell]) > + float left = fCellWidth[kPositionCell] + fCellWidth[kEncodingCell]; > + if (where.x < left) > return; > > int32 clicks = 0; > @@ -169,11 +169,7 @@ StatusView::MouseDown(BPoint where) > return; > > BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); > - float left = fCellWidth[kPositionCell] + fCellWidth[kEncodingCell]; > - if (where.x < left) > - StyledEditWindow::PopulateEncodingMenu(menu, fEncoding); > - else > - menu->AddItem(new BMenuItem(B_TRANSLATE("Unlock file"), > + menu->AddItem(new BMenuItem(B_TRANSLATE("Unlock file"), > new BMessage(UNLOCK_FILE))); > where.x = left; > where.y = Bounds().bottom; > @@ -203,7 +199,8 @@ StatusView::SetStatus(BMessage* message) > || fEncoding.Compare("\xff\xff") == 0 > || fEncoding.Compare("UTF-8") == 0) > { > - fCellText[kEncodingCell] = "UTF-8"; > + // do not display default UTF-8 encoding > + fCellText[kEncodingCell].Truncate(0); > fEncoding.Truncate(0); > } else { > const BCharacterSet* charset > @@ -211,7 +208,6 @@ StatusView::SetStatus(BMessage* message) > fCellText[kEncodingCell] > = charset != NULL ? charset->GetPrintName() : > ""; > } > - fCellText[kEncodingCell] << " " UTF8_EXPAND_ARROW; > } > > bool modified = false; > diff --git a/src/apps/stylededit/StyledEditWindow.cpp > b/src/apps/stylededit/StyledEditWindow.cpp > index fac2651..68986e8 100644 > --- a/src/apps/stylededit/StyledEditWindow.cpp > +++ b/src/apps/stylededit/StyledEditWindow.cpp > @@ -47,6 +47,7 @@ > #include <TextView.h> > #include <TranslationUtils.h> > #include <UnicodeChar.h> > +#include <UTF8.h> > > > using namespace BPrivate; > @@ -1295,7 +1296,7 @@ StyledEditWindow::_InitWindow(uint32 encoding) > > BMessage *message = new BMessage(MENU_RELOAD); > message->AddString("encoding", "auto"); > - menu->AddItem(fEncodingItem = new BMenuItem(PopulateEncodingMenu( > + menu->AddItem(fEncodingItem = new BMenuItem(_PopulateEncodingMenu( > new BMenu(B_TRANSLATE("Text encoding")), "UTF-8"), > message)); > fEncodingItem->SetEnabled(false); > @@ -1501,13 +1502,27 @@ StyledEditWindow::_ReloadDocument(BMessage* message) > return; > } > > + const BCharacterSet* charset > + = BCharacterSetRoster::GetCharacterSetByFontID( > + fTextView->GetEncoding()); > const char* forceEncoding = NULL; > if (message->FindString("encoding", &forceEncoding) != B_OK) { > - const BCharacterSet* charset > - = BCharacterSetRoster::GetCharacterSetByFontID( > - fTextView->GetEncoding()); > if (charset != NULL) > forceEncoding = charset->GetName(); > + } else { > + if (charset != NULL) { > + // UTF8 id assumed equal to -1 > + const uint32 idUTF8 = -1; > + uint32 id = charset->GetConversionID(); > + if (strcmp(forceEncoding, "next") == 0) > + id = id == B_MS_WINDOWS_1250_CONVERSION ? > idUTF8 : id + 1; > + else if (strcmp(forceEncoding, "previous") == 0) > + id = id == idUTF8 ? > B_MS_WINDOWS_1250_CONVERSION : id - 1; > + const BCharacterSet* newCharset > + = > BCharacterSetRoster::GetCharacterSetByConversionID(id); > + if (newCharset != NULL) > + forceEncoding = newCharset->GetName(); > + } > } > > BScrollBar* vertBar = fScrollView->ScrollBar(B_VERTICAL); > @@ -1888,7 +1903,7 @@ StyledEditWindow::_ShowAlert(const BString& text, const > BString& label, > > > BMenu* > -StyledEditWindow::PopulateEncodingMenu(BMenu* menu, const char* > currentEncoding) > +StyledEditWindow::_PopulateEncodingMenu(BMenu* menu, const char* > currentEncoding) > { > menu->SetRadioMode(true); > BString encoding(currentEncoding); > @@ -1919,6 +1934,13 @@ StyledEditWindow::PopulateEncodingMenu(BMenu* menu, > const char* currentEncoding) > message->AddString("encoding", "auto"); > menu->AddItem(new BMenuItem(B_TRANSLATE("Autodetect"), message)); > > + message = new BMessage(MENU_RELOAD); > + message->AddString("encoding", "next"); > + AddShortcut(B_PAGE_DOWN, B_OPTION_KEY, message); > + message = new BMessage(MENU_RELOAD); > + message->AddString("encoding", "previous"); > + AddShortcut(B_PAGE_UP, B_OPTION_KEY, message); > + > return menu; > } > > diff --git a/src/apps/stylededit/StyledEditWindow.h > b/src/apps/stylededit/StyledEditWindow.h > index af8dc04..bf239a6 100644 > --- a/src/apps/stylededit/StyledEditWindow.h > +++ b/src/apps/stylededit/StyledEditWindow.h > @@ -49,8 +49,6 @@ public: > bool > caseSensitive); > bool > IsDocumentEntryRef(const entry_ref* ref); > > - static BMenu* PopulateEncodingMenu(BMenu* > menu, > - const > char* encoding); > private: > void _InitWindow(uint32 > encoding = 0); > void _LoadAttrs(); > @@ -79,6 +77,8 @@ private: > const > BString& label, const BString& label2, > const > BString& label3, > > alert_type type) const; > + BMenu* > _PopulateEncodingMenu(BMenu* menu, > + const > char* encoding); > > // node monitoring helper > class _NodeMonitorSuspender { > > ############################################################################ > > Revision: hrev45500 > Commit: a6ea4a194f34649fd0153e41a27284cc9cae3983 > URL: http://cgit.haiku-os.org/haiku/commit/?id=a6ea4a1 > Author: Siarzhuk Zharski <zharik@xxxxxx> > Date: Sun Apr 14 16:35:12 2013 UTC > > Ticket: https://dev.haiku-os.org/ticket/9636 > > Fix "Error opening terminal:xterm-256color" issue (#9636) > > Looks like switching to declare "xterm-256color" terminal emulation was > made a bit early: there are lot of servers that still do not know about > this terminal. As was discussed in #9636 the only acceptable way is to > switch back to "xterm" and adjust corresponding entry in our local > termcap database to support 256 colors. So this changeset: > > * Declare emulated terminal as "xterm"; > * Change the colors and color pairs of "xterm" termcap entry to support > 256 colors; > > Workarounds the #9636. Should be upgraded to "xterm-256color" some time > in the future. > > ---------------------------------------------------------------------------- > > diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp > index 1179356..b6c70ff 100644 > --- a/src/apps/terminal/Shell.cpp > +++ b/src/apps/terminal/Shell.cpp > @@ -74,7 +74,7 @@ > > // TODO: should extract from /etc/passwd instead??? > const char *kDefaultShell = "/bin/sh"; > -const char *kTerminalType = "xterm-256color"; > +const char *kTerminalType = "xterm"; > > /* > * Set environment variable. > diff --git a/src/libs/termcap/termcap.src b/src/libs/termcap/termcap.src > index ba69e28..1c08373 100644 > --- a/src/libs/termcap/termcap.src > +++ b/src/libs/termcap/termcap.src > @@ -6202,9 +6202,10 @@ xterm-24|vs100|xterms|xterm terminal emulator (X > Window System):\ > :u7=\E[6n:u8=\E[?1;2c:u9=\E[c:ue=\E[m:up=\E[A:us=\E[4m: > > # This is xterm for ncurses. > +# Haiku: This one customized to declare 256 colors support > xterm|xterm terminal emulator (X Window System):\ > :5i:NP:am:bs:km:mi:ms:ut:xn:\ > - :Co#8:co#80:it#8:li#24:pa#64:\ > + :Co#256:co#80:it#8:li#24:pa#32767:\ > :#2=\E[1;2H:#3=\E[2;2~:#4=\E[1;2D:%c=\E[6;2~:%e=\E[5;2~:\ > :%i=\E[1;2C:*4=\E[3;2~:*7=\E[1;2F:@7=\EOF:@8=\EOM:\ > :AB=\E[4%dm:AF=\E[3%dm:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ > >