diff --git a/ChangeLog b/ChangeLog index 4876a7b512..b163fb2ac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,52 @@ +2000-10-16 Angus Leeming + + * forms/layout_forms.fd: + * src/layout_forms.C (create_form_form_character): small change to use + labelframe rather than engraved frame + text + + * src/lyx_gui.C (create_forms): initialise choice_language with some + arbitrary value to prevent segfault when dialog is shown. + +2000-10-16 Baruch Even + + * src/converter.C (runLaTeX, scanLog): Added a warning when there + is no resulting file. This pertains only to LaTeX output. + +2000-10-14 Dekel Tsur + + * src/text.C (Backspace): Make sure that the row of the cursor is + rebreaked. + + * src/lyxfunc.C (Dispatch): Call to showState() after insertion of + a char. + + * src/lyx_gui.C (init): Prevent a crash when only one font from + menu/popup fonts is not found. + + * lib/lyxrc.example: Add an example for binding a key for language + switching. + +2000-10-15 Dekel Tsur + + * src/converter.C (GetReachable): Changed the returned type to + vector + (IsReachable): New method + + * src/MenuBackend.C (expand): Handle formats that appear more + than once + +2000-10-16 Jean-Marc Lasgouttes + + * src/frontends/support/Makefile.am + (libfrontendsupport_la_EXTRA_DIST): add LyXImage_X.[Ch] here and + not in SOURCES. + + * lib/CREDITS: add Garst Reese. + + * src/support/snprintf.h: add extern "C" {} around the definitions. + + * src/cheaders/cstdarg: new header file, taken from GNU libstdc++. + 2000-10-13 Angus Leeming * src/combox.[Ch]: diff --git a/forms/layout_forms.fd b/forms/layout_forms.fd index d29fcd32cc..ead098f7ed 100644 --- a/forms/layout_forms.fd +++ b/forms/layout_forms.fd @@ -11,7 +11,7 @@ SnapGrid: 5 Name: form_character Width: 300 Height: 415 -Number of Objects: 16 +Number of Objects: 14 -------------------- class: FL_BOX @@ -31,42 +31,6 @@ name: callback: argument: --------------------- -class: FL_FRAME -type: ENGRAVED_FRAME -box: 10 325 280 45 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NorthEast -name: -callback: -argument: - --------------------- -class: FL_FRAME -type: ENGRAVED_FRAME -box: 10 265 280 45 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NorthEast -name: -callback: -argument: - -------------------- class: FL_FRAME type: ENGRAVED_FRAME @@ -247,42 +211,6 @@ name: check_toggle_all callback: argument: --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 255 210 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: These are never toggled -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NorthEast -name: -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 315 215 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: These are always toggled -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NorthEast -name: -callback: -argument: - -------------------- class: FL_CHOICE type: DROPLIST_CHOICE @@ -301,6 +229,42 @@ name: choice_language callback: argument: +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 10 265 280 45 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: These are never toggled +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NorthWest FL_NorthEast +name: +callback: +argument: + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 10 325 280 45 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: These are always toggled +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NorthWest FL_NorthEast +name: +callback: +argument: + =============== FORM =============== Name: form_preamble Width: 380 diff --git a/lib/CREDITS b/lib/CREDITS index 8f73a1680e..07598646f8 100644 --- a/lib/CREDITS +++ b/lib/CREDITS @@ -147,6 +147,10 @@ @iE-mail: rae@elec.uq.edu.au bug reports/fixes, Itemize Bullet Selection, xforms-0.81 + gcc-2.6.3 compatibility +@bGarst R. Reese +@iE-mail: reese@isn.net + provided hollywood and broadway classes + for writing screen scripts and plays @bBernd Rellermeyer @iE-mail: 100.41728@germanynet.de Support for Koma-Script family of classes diff --git a/lib/lyxrc.example b/lib/lyxrc.example index e30863e900..3ff19d53da 100644 --- a/lib/lyxrc.example +++ b/lib/lyxrc.example @@ -574,6 +574,12 @@ # Default is "true" #\mark_foreign_language false +# It is possible to bind keys for changing the language inside a document. +# For example, the following command will cause F12 to switch between French +# and English in a French document, and in a document of other language it will +# switch between that language and French. +#\bind "F12" "language french" + # # HEBREW SUPPORT SECTION #################################################### # diff --git a/src/MenuBackend.C b/src/MenuBackend.C index acd8603743..2c82cde44a 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -23,6 +23,7 @@ #include "gettext.h" #include "lastfiles.h" #include "bufferlist.h" +#include "converter.h" #include "exporter.h" #include "support/filetools.h" #include "support/lyxfunctional.h" @@ -35,6 +36,7 @@ using std::endl; using std::vector; using std::pair; using std::find_if; +using std::sort; // This is the global menu definition MenuBackend menubackend; @@ -190,6 +192,11 @@ Menu & Menu::read(LyXLex & lex) return *this; } +struct compare_formatpair { + bool operator()(FormatPair const & a, FormatPair const & b) { + return a.format->prettyname < b.format->prettyname; + } +}; void Menu::expand(Menu & tomenu, Buffer * buf) const { @@ -237,7 +244,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const case MenuItem::ViewFormats: case MenuItem::UpdateFormats: case MenuItem::ExportFormats: { - vector > names; + vector names; kb_action action; if ((*cit).kind() == MenuItem::ViewFormats) { names = Exporter::GetViewableFormats(buf); @@ -249,13 +256,23 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const names = Exporter::GetExportableFormats(buf); action = LFUN_EXPORT; } + sort(names.begin(), names.end(), compare_formatpair()); - for (vector >::const_iterator fit = names.begin(); + for (vector::const_iterator fit = names.begin(); fit != names.end() ; ++fit) { - int action2 = - lyxaction.getPseudoAction(action, - (*fit).first); - string label = (*fit).second; + string fmt = (*fit).format->name; + string label = (*fit).format->prettyname; + if ((*fit).from && + ( (fit != names.begin() && + (*fit).format == (*(fit-1)).format) || + (fit+1 != names.end() && + (*fit).format == (*(fit+1)).format) )) { + fmt += ":" + (*fit).from->name; + string head; + split((*fit).command, head, ' '); + label += _(" (using ") + head + ")"; + } + int action2 = lyxaction.getPseudoAction(action, fmt); tomenu.add(MenuItem(MenuItem::Command, label, action2)); } diff --git a/src/cheaders/cstdarg b/src/cheaders/cstdarg new file mode 100644 index 0000000000..324f5a1c19 --- /dev/null +++ b/src/cheaders/cstdarg @@ -0,0 +1,7 @@ +// -*- C++ -*- forwarding header. +// This file is part of the GNU ANSI C++ Library. + +#ifndef __CSTDARG__ +#define __CSTDARG__ +#include +#endif diff --git a/src/converter.C b/src/converter.C index 179de6ee1b..9773b5fbcb 100644 --- a/src/converter.C +++ b/src/converter.C @@ -15,7 +15,6 @@ #endif #include -#include // sort() #include "converter.h" #include "lyxrc.h" @@ -33,7 +32,6 @@ using std::map; using std::vector; using std::queue; using std::pair; -using std::sort; using std::endl; ////////////////////////////////////////////////////////////////////////////// @@ -53,7 +51,7 @@ string const add_options(string const & command, string const & options) ////////////////////////////////////////////////////////////////////////////// Format::Format(string const & n) - : name(n), in_degree(0) + : name(n) { struct Item { char const * name; @@ -209,23 +207,19 @@ void Converter::Add(string const & from, string const & to, commands.push_back(Com); Formats::Add(from); Formats::Add(to); - ++Formats::GetFormat(to)->in_degree; } -vector< pair > const +vector const Converter::GetReachable(string const & from, bool only_viewable) { - vector< pair > result; + vector result; Format * format = Formats::GetFormat(from); if (!format) return result; - int sort_start = 0; - if (!only_viewable || !format->viewer.empty()) { - result.push_back(pair(from, format->prettyname)); - sort_start = 1; - } + if (!only_viewable || !format->viewer.empty()) + result.push_back(FormatPair(format, 0, "")); queue< vector::iterator > Q; for (vector::iterator it = commands.begin(); @@ -238,18 +232,12 @@ Converter::GetReachable(string const & from, bool only_viewable) while (!Q.empty()) { vector::iterator it = Q.front(); - format = Formats::GetFormat((*it).to); - string name = format->name; - string prettyname = format->prettyname; - if (format->in_degree > 1) { - name += ":" + (*it).from; - string tmp; - split((*it).command, tmp, ' '); - prettyname += _(" (using ") + tmp + ")"; - } - if (!only_viewable || !format->viewer.empty()) - result.push_back(pair(name, prettyname)); Q.pop(); + format = Formats::GetFormat((*it).to); + if (!only_viewable || !format->viewer.empty()) + result.push_back(FormatPair(format, + Formats::GetFormat((*it).from), + (*it).command)); for (vector::iterator it2 = commands.begin(); it2 != commands.end(); ++it2) if (!(*it2).visited && (*it).to == (*it2).from) { @@ -258,10 +246,42 @@ Converter::GetReachable(string const & from, bool only_viewable) } } - sort(result.begin() + sort_start, result.end()); return result; } +bool Converter::IsReachable(string const & from, string const & target_format) +{ + Format * format = Formats::GetFormat(from); + if (!format) + return false; + else if (format->name == target_format) + return true; + + queue< vector::iterator > Q; + for (vector::iterator it = commands.begin(); + it != commands.end(); ++it) + if ((*it).from == from) { + Q.push(it); + (*it).visited = true; + } else + (*it).visited = false; + + while (!Q.empty()) { + vector::iterator it = Q.front(); + Q.pop(); + format = Formats::GetFormat((*it).to); + if (format->name == target_format) + return true; + for (vector::iterator it2 = commands.begin(); + it2 != commands.end(); ++it2) + if (!(*it2).visited && (*it).to == (*it2).from) { + Q.push(it2); + (*it2).visited = true; + } + } + return false; +} + bool Converter::Convert(Buffer const * buffer, string const & from_file, string const & to_file, string const & using_format, @@ -471,6 +491,12 @@ bool Converter::scanLog(Buffer const * buffer, string const & command, bv->redraw(); bv->fitCursor(bv->text); } + if (result & LaTeX::NO_OUTPUT) { + string const s = _("The operation resulted in"); + string const t = _("an empty file."); + WriteAlert(_("Resulting file is empty"), s, t); + return false; + } AllowInput(bv); } if ((result & LaTeX::ERRORS)) { @@ -529,6 +555,10 @@ bool Converter::runLaTeX(Buffer const * buffer, string const & command) bv->redraw(); bv->fitCursor(bv->text); } + } else if (result & LaTeX::NO_OUTPUT) { + string const s = _("The operation resulted in"); + string const t = _("an empty file."); + WriteAlert(_("Resulting file is empty"), s, t); } // check return value from latex.run(). @@ -554,7 +584,12 @@ bool Converter::runLaTeX(Buffer const * buffer, string const & command) if (bv) AllowInput(bv); - return (result & (LaTeX::NO_LOGFILE | LaTeX::ERRORS)) == 0; + int const ERROR_MASK = + LaTeX::NO_LOGFILE | + LaTeX::ERRORS | + LaTeX::NO_OUTPUT; + + return (result & ERROR_MASK) == 0; } @@ -613,3 +648,8 @@ string const Converter::dvips_options(Buffer const * buffer) result += ' ' + lyxrc.print_landscape_flag; return result; } + +void Converter::init() +{ + Formats::Add("txt"); +} diff --git a/src/converter.h b/src/converter.h index 8e282352f3..b23a0ffd62 100644 --- a/src/converter.h +++ b/src/converter.h @@ -57,7 +57,7 @@ struct Command { class Format { public: /// - Format() : in_degree(0) {} + Format() {} /// Format(string const & n); /// @@ -66,8 +66,19 @@ public: string prettyname; /// string viewer; +}; + +class FormatPair { +public: /// - int in_degree; + Format * format; + /// + Format * from; + /// + string command; + /// + FormatPair(Format * f1, Format * f2, string c) + : format(f1), from(f2), command(c) {} }; /// @@ -102,12 +113,17 @@ public: void Add(string const & from, string const & to, string const & command, string const & flags); /// + + /// static - std::vector > const + std::vector const GetReachable(string const & from, bool only_viewable = false); /// static + bool IsReachable(string const & from, string const & target_format); + /// + static bool Convert(Buffer const * buffer, string const & from_file, string const & to_file, string const & using_format, string * view_file = 0); @@ -120,6 +136,9 @@ public: /// static string const dvips_options(Buffer const * buffer); + /// + static + void init(); private: /// static diff --git a/src/exporter.C b/src/exporter.C index e2c4c37e7c..40986a514f 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -15,14 +15,13 @@ #endif #include "exporter.h" -#include "converter.h" #include "buffer.h" #include "lyx_cb.h" //ShowMessage() #include "support/filetools.h" #include "lyxrc.h" +#include "converter.h" using std::vector; -using std::pair; bool Exporter::Export(Buffer * buffer, string const & format0, bool put_in_tempdir, string * view_file) @@ -84,37 +83,31 @@ bool Exporter::Preview(Buffer * buffer, string const & format0) bool Exporter::IsExportable(Buffer const * buffer, string const & format) { - // This is not efficient (Dekel) - vector > const v = GetExportableFormats(buffer); - for (vector >::const_iterator it = v.begin(); - it != v.end(); ++it) { - string format2; - split((*it).first, format2, ':'); - if (format == format2) - return true; - } - return false; + return format == "txt" || + Converter::IsReachable(BufferExtension(buffer), format); } -vector > const +vector const Exporter::GetExportableFormats(Buffer const * buffer) { - vector > result = + vector result = Converter::GetReachable(BufferExtension(buffer), false); - result.push_back(pair("txt", "Ascii")); + Format * format = Formats::GetFormat("txt"); + if (format) + result.push_back(FormatPair(format , 0, "")); return result; } -vector > const +vector const Exporter::GetViewableFormats(Buffer const * buffer) { - vector > result = + vector result = Converter::GetReachable(BufferExtension(buffer), true); Format * format = Formats::GetFormat("txt"); if (format && !format->viewer.empty()) - result.push_back(pair("txt", "Ascii")); + result.push_back(FormatPair(format , 0, "")); return result; } diff --git a/src/exporter.h b/src/exporter.h index 26e1a5dad0..f8c9ac7d45 100644 --- a/src/exporter.h +++ b/src/exporter.h @@ -20,8 +20,8 @@ #include "LString.h" class Buffer; +class FormatPair; -/// class Exporter { public: /// @@ -36,11 +36,11 @@ public: bool IsExportable(Buffer const * buffer, string const & format); /// static - std::vector > const + std::vector const GetExportableFormats(Buffer const * buffer); /// static - std::vector > const + std::vector const GetViewableFormats(Buffer const * buffer); /// static diff --git a/src/frontends/support/Makefile.am b/src/frontends/support/Makefile.am index ec57ed83b0..3da8782920 100644 --- a/src/frontends/support/Makefile.am +++ b/src/frontends/support/Makefile.am @@ -8,6 +8,8 @@ INCLUDES = -I${srcdir}/../../ $(SIGC_CFLAGS) libfrontendsupport_la_SOURCES = \ LyXImage.h \ - LyXImage.C \ + LyXImage.C + +libfrontendsupport_la_EXTRA_DIST = \ LyXImage_X.h \ LyXImage_X.C diff --git a/src/layout_forms.C b/src/layout_forms.C index 3c96d9c089..4b5ba67d65 100644 --- a/src/layout_forms.C +++ b/src/layout_forms.C @@ -17,12 +17,6 @@ FD_form_character *create_form_form_character(void) fdui->form_character = fl_bgn_form(FL_NO_BOX, 300, 415); obj = fl_add_box(FL_UP_BOX, 0, 0, 300, 415, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 325, 280, 45, ""); - fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 265, 280, 45, ""); - fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fl_set_object_resize(obj, FL_RESIZE_X); obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 240, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); @@ -67,21 +61,17 @@ FD_form_character *create_form_form_character(void) fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 215, 255, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 255, 210, 20, _("These are never toggled")); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); - fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 315, 215, 20, _("These are always toggled")); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); - fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fl_set_object_resize(obj, FL_RESIZE_X); fdui->choice_language = obj = fl_add_choice(FL_DROPLIST_CHOICE, 95, 175, 190, 30, _("Language:")); fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 265, 280, 45, _("These are never toggled")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 325, 280, 45, _("These are always toggled")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_end_form(); fdui->form_character->fdui = fdui; diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 20c8b6ffc4..6829b15472 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -185,35 +185,41 @@ void LyXGUI::init() if (lyxrc.font_norm_menu.empty()) lyxrc.font_norm_menu = lyxrc.font_norm; // Set the font name for popups and menus - string menufontname = lyxrc.menu_font_name + string boldfontname = lyxrc.menu_font_name + "-*-*-*-?-*-*-*-*-" + lyxrc.font_norm_menu; // "?" means "scale that font" - string popupfontname = lyxrc.popup_font_name + string fontname = lyxrc.popup_font_name + "-*-*-*-?-*-*-*-*-" + lyxrc.font_norm_menu; - int bold = fl_set_font_name(FL_BOLD_STYLE, menufontname.c_str()); - int normal = fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str()); + int bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str()); + int normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str()); if (bold < 0) lyxerr << "Could not set menu font to " - << menufontname << endl; + << boldfontname << endl; if (normal < 0) lyxerr << "Could not set popup font to " - << popupfontname << endl; + << fontname << endl; if (bold < 0 && normal < 0) { lyxerr << "Using 'helvetica' font for menus" << endl; - bold = fl_set_font_name(FL_BOLD_STYLE, - "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1"); - normal = fl_set_font_name(FL_NORMAL_STYLE, - "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1"); + boldfontname = "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1"; + fontname = "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1"; + bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str()); + normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str()); + if (bold < 0 && normal < 0) { lyxerr << "Could not find helvetica font. Using 'fixed'." << endl; - normal = fl_set_font_name(FL_NORMAL_STYLE, "fixed"); + fl_set_font_name(FL_NORMAL_STYLE, "fixed"); + normal = bold = 0; } } + if (bold < 0) + fl_set_font_name(FL_BOLD_STYLE, fontname.c_str()); + else if (normal < 0) + fl_set_font_name(FL_NORMAL_STYLE, boldfontname.c_str()); // put here (after fl_initialize) to avoid segfault. Cannot be done // in setDefaults() (Matthias 140496) @@ -312,6 +318,10 @@ void LyXGUI::create_forms() fl_addto_choice(fd_form_character->choice_color, _(" No change %l| No color | Black | White | Red | Green " "| Blue | Cyan | Magenta | Yellow %l| Reset ")); + // Appears to need initialising to avoid seg fault when dialog is + // launched. Over-written by combo_language2, below + fl_addto_choice(fd_form_character->choice_language, + _(" English %l| German | French ")); fl_set_form_minsize(fd_form_character->form_character, fd_form_character->form_character->w, fd_form_character->form_character->h); diff --git a/src/lyx_main.C b/src/lyx_main.C index eaf8725d08..045e8cc72a 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -39,6 +39,7 @@ #include "ToolbarDefaults.h" #include "lyxlex.h" #include "encoding.h" +#include "converter.h" using std::endl; @@ -404,6 +405,9 @@ void LyX::init(int */*argc*/, char **argv, bool gui) if (!ReadRcFile("preferences")) ReadRcFile("lyxrc"); + /// Init Converter + Converter::init(); + // Read encodings ReadEncodingsFile("encodings"); // Read languages diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 97d2378990..f84201f8b3 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -2895,6 +2895,8 @@ string const LyXFunc::Dispatch(int ac, owner->view()->text->sel_cursor = owner->view()->text->cursor; moveCursorUpdate(false); + owner->showState(); // current_font.number can change + // so we need to update the minibuffer } break; @@ -3030,6 +3032,8 @@ string const LyXFunc::Dispatch(int ac, owner->view()->text->sel_cursor = owner->view()->text->cursor; moveCursorUpdate(false); + owner->showState(); // current_font.number can change + // so we need to update the minibuffer return string(); } else { // why is an "Unknown action" with empty diff --git a/src/support/snprintf.h b/src/support/snprintf.h index cad692e541..6ab2dcc8ea 100644 --- a/src/support/snprintf.h +++ b/src/support/snprintf.h @@ -4,23 +4,31 @@ #define PORTABLE_SNPRINTF_VERSION_MAJOR 2 #define PORTABLE_SNPRINTF_VERSION_MINOR 1 +#ifdef __cplusplus +extern "C" { +#endif + #ifdef HAVE_SNPRINTF #include #else -extern int snprintf(char *, size_t, const char *, /*args*/ ...); -extern int vsnprintf(char *, size_t, const char *, va_list); +int snprintf(char *, size_t, const char *, /*args*/ ...); +int vsnprintf(char *, size_t, const char *, va_list); #endif #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF) -extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...); -extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap); +int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...); +int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap); #define snprintf portable_snprintf #define vsnprintf portable_vsnprintf #endif -extern int asprintf (char **ptr, const char *fmt, /*args*/ ...); -extern int vasprintf (char **ptr, const char *fmt, va_list ap); -extern int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...); -extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap); +int asprintf (char **ptr, const char *fmt, /*args*/ ...); +int vasprintf (char **ptr, const char *fmt, va_list ap); +int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...); +int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap); +#ifdef __cplusplus +} /* end of extern "C" */ +#endif + #endif diff --git a/src/text.C b/src/text.C index 84a7967b30..0e50ffcf8c 100644 --- a/src/text.C +++ b/src/text.C @@ -2956,10 +2956,19 @@ void LyXText::Backspace(BufferView * bview) status = LyXText::NEED_MORE_REFRESH; BreakAgainOneRow(bview, row); + // will the cursor be in another row now? + if (row->next() && row->next()->par() == row->par() && + RowLast(row) <= cursor.pos()) { + row = row->next(); + BreakAgainOneRow(bview, row); + } + SetCursor(bview, cursor.par(), cursor.pos(), false, cursor.boundary()); - // cursor MUST be in row now - - need_break_row = row->next(); + + if (row->next() && row->next()->par() == row->par()) + need_break_row = row->next(); + else + need_break_row = 0; } else { // set the dimensions of the row row->fill(Fill(bview, row, workWidth(bview)));