]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
update SCons
[lyx.git] / src / Buffer.cpp
index 98fdc287a6542f09d27f72ded17d4eadb7a6c5de..b399f6483117539f03861d0271d942d4d2425324 100644 (file)
@@ -126,7 +126,7 @@ namespace {
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 390; // ps: forward view
+int const LYX_FORMAT = 397; // rgh: remove Nameref support
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
@@ -1983,28 +1983,37 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                break;
 
        case LFUN_BRANCH_ADD: {
-               docstring const branch_name = func.argument();
+               docstring branch_name = func.argument();
                if (branch_name.empty()) {
                        dispatched = false;
                        break;
                }
                BranchList & branch_list = params().branchlist();
-               Branch * branch = branch_list.find(branch_name);
-               if (branch) {
-                       LYXERR0("Branch " << branch_name << " already exists.");
-                       dr.setError(true);
-                       docstring const msg = 
-                               bformat(_("Branch \"%1$s\" already exists."), branch_name);
-                       dr.setMessage(msg);
-               } else {
-                       branch_list.add(branch_name);
-                       branch = branch_list.find(branch_name);
-                       string const x11hexname = X11hexname(branch->color());
-                       docstring const str = branch_name + ' ' + from_ascii(x11hexname);
-                       lyx::dispatch(FuncRequest(LFUN_SET_COLOR, str));        
-                       dr.setError(false);
-                       dr.update(Update::Force);
+               vector<docstring> const branches =
+                       getVectorFromString(branch_name, branch_list.separator());
+               docstring msg;
+               for (vector<docstring>::const_iterator it = branches.begin();
+                    it != branches.end(); ++it) {
+                       branch_name = *it;
+                       Branch * branch = branch_list.find(branch_name);
+                       if (branch) {
+                               LYXERR0("Branch " << branch_name << " already exists.");
+                               dr.setError(true);
+                               if (!msg.empty())
+                                       msg += ("\n");
+                               msg += bformat(_("Branch \"%1$s\" already exists."), branch_name);
+                       } else {
+                               branch_list.add(branch_name);
+                               branch = branch_list.find(branch_name);
+                               string const x11hexname = X11hexname(branch->color());
+                               docstring const str = branch_name + ' ' + from_ascii(x11hexname);
+                               lyx::dispatch(FuncRequest(LFUN_SET_COLOR, str));
+                               dr.setError(false);
+                               dr.update(Update::Force);
+                       }
                }
+               if (!msg.empty())
+                       dr.setMessage(msg);
                break;
        }
 
@@ -2028,6 +2037,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                        branch->setSelected(func.action() == LFUN_BRANCH_ACTIVATE);
                        dr.setError(false);
                        dr.update(Update::Force);
+                       dr.forceBufferUpdate();
                }
                break;
        }
@@ -2062,8 +2072,10 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                        }
                }
 
-               if (success)
+               if (success) {
                        dr.update(Update::Force);
+                       dr.forceBufferUpdate();
+               }
                break;
        }
 
@@ -2189,8 +2201,10 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                Language const * newL = languages.getLanguage(argument);
                if (!newL || oldL == newL)
                        break;
-               if (oldL->rightToLeft() == newL->rightToLeft() && !isMultiLingual())
+               if (oldL->rightToLeft() == newL->rightToLeft() && !isMultiLingual()) {
                        changeLanguage(oldL, newL);
+                       dr.forceBufferUpdate();
+               }
                break;
        }