]> git.lyx.org Git - lyx.git/blob - src/BufferView2.C
fix bug with ever-growing bst files list (from herbert)
[lyx.git] / src / BufferView2.C
1 /* This file is part of
2  * ======================================================
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-2001 The LyX Team.
8  *
9  * ====================================================== */
10
11 #include <config.h>
12
13 #include "BufferView.h"
14 #include "buffer.h"
15 #include "lyxcursor.h"
16 #include "lyxtext.h"
17 #include "frontends/LyXView.h"
18 #include "bufferlist.h"
19 #include "frontends/screen.h"
20 #include "LaTeX.h"
21 #include "BufferView_pimpl.h"
22 #include "language.h"
23 #include "gettext.h"
24 #include "undo_funcs.h"
25 #include "debug.h"
26 #include "iterators.h"
27 #include "lyxlex.h"
28
29 #include "frontends/Alert.h"
30 #include "frontends/Dialogs.h"
31
32 #include "insets/insetcommand.h" //ChangeRefs
33 #include "insets/inseterror.h"
34
35 #include "support/FileInfo.h"
36 #include "support/filetools.h"
37 #include "support/lyxfunctional.h" //equal_1st_in_pair
38 #include "support/types.h"
39 #include "support/lyxalgo.h" // lyx_count
40
41 #include <fstream>
42
43 extern BufferList bufferlist;
44
45 using lyx::pos_type;
46
47 using std::pair;
48 using std::endl;
49 using std::ifstream;
50 using std::vector;
51 using std::find;
52 using std::count_if;
53
54
55 // Inserts a file into current document
56 bool BufferView::insertLyXFile(string const & filen)
57         //
58         // Copyright CHT Software Service GmbH
59         // Uwe C. Schroeder
60         //
61         // Insert a Lyxformat - file into current buffer
62         //
63         // Moved from lyx_cb.C (Lgb)
64 {
65         if (filen.empty()) return false;
66
67         string const fname = MakeAbsPath(filen);
68
69         // check if file exist
70         FileInfo const fi(fname);
71
72         if (!fi.readable()) {
73                 Alert::alert(_("Error!"),
74                            _("Specified file is unreadable: "),
75                            MakeDisplayPath(fname, 50));
76                 return false;
77         }
78
79         beforeChange(text);
80
81         ifstream ifs(fname.c_str());
82         if (!ifs) {
83                 Alert::alert(_("Error!"),
84                            _("Cannot open specified file: "),
85                            MakeDisplayPath(fname, 50));
86                 return false;
87         }
88
89         int const c = ifs.peek();
90
91         LyXLex lex(0, 0);
92         lex.setStream(ifs);
93
94         bool res = true;
95
96         if (c == '#') {
97                 lyxerr[Debug::INFO] << "Will insert file with header" << endl;
98                 res = buffer()->readFile(lex, text->cursor.par());
99         } else {
100                 lyxerr[Debug::INFO] << "Will insert file without header"
101                                     << endl;
102                 res = buffer()->readLyXformat2(lex, text->cursor.par());
103         }
104
105         resize();
106         return res;
107 }
108
109
110 bool BufferView::removeAutoInsets()
111 {
112         // keep track of which pos and par the cursor was on
113         Paragraph * cursor_par = text->cursor.par();
114         Paragraph * cursor_par_prev = cursor_par ? cursor_par->previous() : 0;
115         Paragraph * cursor_par_next = cursor_par ? cursor_par->next() : 0;
116         pos_type cursor_pos = text->cursor.pos();
117
118         bool found = false;
119
120         // Trap the deletion of the paragraph the cursor is in.
121         // Iterate until we find a paragraph that won't be immediately deleted.
122         // In reality this should mean we only execute the body of the while
123         // loop once at most.  However for safety we iterate rather than just
124         // make this an if () conditional.
125         while ((cursor_par_prev || cursor_par_next)
126                && text->setCursor(this,
127                                   cursor_par_prev ? cursor_par_prev : cursor_par_next,
128                                   0)) {
129                 // We just removed cursor_par so have to fix the "cursor"
130                 if (cursor_par_prev) {
131                         // '.' = cursor_par
132                         //  a -> a.
133                         // .
134                         cursor_par = cursor_par_prev;
135                         cursor_pos = cursor_par->size();
136                 } else {
137                         // .  -> .a
138                         //  a
139                         cursor_par = cursor_par_next;
140                         cursor_pos = 0;
141                 }
142                 cursor_par_prev = cursor_par->previous();
143                 cursor_par_next = cursor_par->next();
144         }
145
146         // Iterate through the paragraphs removing autoDelete insets as we go.
147         // If the paragraph ends up empty after all the autoDelete insets are
148         // removed that paragraph will be removed by the next setCursor() call.
149         ParIterator it = buffer()->par_iterator_begin();
150         ParIterator end = buffer()->par_iterator_end();
151         for (; it != end; ++it) {
152                 Paragraph * par = *it;
153                 Paragraph * par_prev = par ? par->previous() : 0;
154                 bool removed = false;
155
156                 if (text->setCursor(this, par, 0)
157                     && cursor_par == par_prev) {
158                         // The previous setCursor line was deleted and that
159                         // was the cursor_par line.  This can only happen if an
160                         // error box was the sole item on cursor_par.
161                         // It is possible for cursor_par_prev to be stray if
162                         // the line it pointed to only had a error box on it
163                         // so we have to set it to a known correct value.
164                         // This is often the same value it already had.
165                         cursor_par_prev = par->previous();
166                         if (cursor_par_prev) {
167                                 // '|' = par, '.' = cursor_par, 'E' = error box
168                                 // First step below may occur before while{}
169                                 //  a    |a      a     a     a.
170                                 //  E -> .E -> |.E -> .  -> |b
171                                 // .      b      b    |b
172                                 //  b
173                                 cursor_par = cursor_par_prev;
174                                 cursor_pos = cursor_par_prev->size();
175                                 cursor_par_prev = cursor_par->previous();
176                                 // cursor_par_next remains the same
177                         } else if (cursor_par_next) {
178                                 // First step below may occur before while{}
179                                 // .
180                                 //  E -> |.E -> |.  -> . -> .|a
181                                 //  a      a      a    |a
182                                 cursor_par = cursor_par_next;
183                                 cursor_pos = 0;
184                                 // cursor_par_prev remains unset
185                                 cursor_par_next = cursor_par->next();
186                         } else {
187                                 // I can't find a way to trigger this
188                                 // so it should be unreachable code
189                                 // unless the buffer is corrupted.
190                                 lyxerr << "BufferView::removeAutoInsets() is bad\n";
191                         }
192                 }
193
194                 Paragraph::inset_iterator pit = par->inset_iterator_begin();
195                 Paragraph::inset_iterator pend = par->inset_iterator_end();
196                 while (pit != pend) {
197                         if (pit->autoDelete()) {
198                                 removed = true;
199                                 pos_type const pos = pit.getPos();
200
201                                 par->erase(pos);
202                                 // We just invalidated par's inset iterators so
203                                 // we get the next valid iterator position
204                                 pit = par->InsetIterator(pos);
205                                 // and ensure we have a valid end iterator.
206                                 pend = par->inset_iterator_end();
207
208                                 if (cursor_par == par) {
209                                         // update the saved cursor position
210                                         if (cursor_pos > pos)
211                                                 --cursor_pos;
212                                 }
213                         } else {
214                                 ++pit;
215                         }
216                 }
217                 if (removed) {
218                         found = true;
219                         text->redoParagraph(this);
220                 }
221         }
222
223         // It is possible that the last line is empty if it was cursor_par
224         // and/or only had an error inset on it.  So we set the cursor to the
225         // start of the doc to force its removal and ensure a valid saved cursor
226         if (text->setCursor(this, text->ownerParagraph(), 0)
227             && 0 == cursor_par_next) {
228                 cursor_par = cursor_par_prev;
229                 cursor_pos = cursor_par->size();
230         } else if (cursor_pos > cursor_par->size()) {
231                 // Some C-Enter lines were removed by the setCursor call which
232                 // then invalidated cursor_pos. It could still be "wrong" because
233                 // the cursor may appear to have jumped but since we collapsed
234                 // some C-Enter lines this should be a reasonable compromise.
235                 cursor_pos = cursor_par->size();
236         }
237
238         // restore the original cursor in its corrected location.
239         text->setCursorIntern(this, cursor_par, cursor_pos);
240
241         return found;
242 }
243
244
245 void BufferView::insertErrors(TeXErrors & terr)
246 {
247         // Save the cursor position
248         LyXCursor cursor = text->cursor;
249
250         TeXErrors::Errors::const_iterator cit = terr.begin();
251         TeXErrors::Errors::const_iterator end = terr.end();
252         for (; cit != end; ++cit) {
253                 string const desctext(cit->error_desc);
254                 string const errortext(cit->error_text);
255                 string const msgtxt = desctext + '\n' + errortext;
256                 int const errorrow = cit->error_in_line;
257
258                 // Insert error string for row number
259                 int tmpid = -1;
260                 int tmppos = -1;
261
262                 if (buffer()->texrow.getIdFromRow(errorrow, tmpid, tmppos)) {
263                         buffer()->texrow.increasePos(tmpid, tmppos);
264                 }
265
266                 Paragraph * texrowpar = 0;
267
268                 if (tmpid == -1) {
269                         texrowpar = text->ownerParagraph();
270                         tmppos = 0;
271                 } else {
272                         texrowpar = buffer()->getParFromID(tmpid);
273                 }
274
275                 if (texrowpar == 0)
276                         continue;
277
278                 InsetError * new_inset = new InsetError(msgtxt);
279                 text->setCursorIntern(this, texrowpar, tmppos);
280                 text->insertInset(this, new_inset);
281                 text->fullRebreak(this);
282         }
283         // Restore the cursor position
284         text->setCursorIntern(this, cursor.par(), cursor.pos());
285 }
286
287
288 void BufferView::setCursorFromRow(int row)
289 {
290         int tmpid = -1;
291         int tmppos = -1;
292
293         buffer()->texrow.getIdFromRow(row, tmpid, tmppos);
294
295         Paragraph * texrowpar;
296
297         if (tmpid == -1) {
298                 texrowpar = text->ownerParagraph();
299                 tmppos = 0;
300         } else {
301                 texrowpar = buffer()->getParFromID(tmpid);
302         }
303         text->setCursor(this, texrowpar, tmppos);
304 }
305
306
307 bool BufferView::insertInset(Inset * inset, string const & lout)
308 {
309         return pimpl_->insertInset(inset, lout);
310 }
311
312
313 /* This is also a buffer property (ale) */
314 // Not so sure about that. a goto Label function can not be buffer local, just
315 // think how this will work in a multiwindo/buffer environment, all the
316 // cursors in all the views showing this buffer will move. (Lgb)
317 // OK, then no cursor action should be allowed in buffer. (ale)
318 bool BufferView::gotoLabel(string const & label)
319
320 {
321         for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
322              it != buffer()->inset_iterator_end(); ++it) {
323                 vector<string> labels = (*it)->getLabelList();
324                 if (find(labels.begin(),labels.end(),label)
325                      != labels.end()) {
326                         beforeChange(text);
327                         text->setCursor(this, it.getPar(), it.getPos());
328                         text->selection.cursor = text->cursor;
329                         update(text, BufferView::SELECT|BufferView::FITCUR);
330                         return true;
331                 }
332         }
333         return false;
334 }
335
336
337 void BufferView::menuUndo()
338 {
339         if (available()) {
340                 owner()->message(_("Undo"));
341                 hideCursor();
342                 beforeChange(text);
343                 update(text, BufferView::SELECT|BufferView::FITCUR);
344                 if (!textUndo(this))
345                         owner()->message(_("No further undo information"));
346                 else
347                         update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
348                 switchKeyMap();
349         }
350 }
351
352
353 void BufferView::menuRedo()
354 {
355 #if 0 // this should not be here (Jug 20011206)
356         if (theLockingInset()) {
357                 owner()->message(_("Redo not yet supported in math mode"));
358                 return;
359         }
360 #endif
361
362         if (available()) {
363                 owner()->message(_("Redo"));
364                 hideCursor();
365                 beforeChange(text);
366                 update(text, BufferView::SELECT|BufferView::FITCUR);
367                 if (!textRedo(this))
368                         owner()->message(_("No further redo information"));
369                 else
370                         update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
371                 switchKeyMap();
372         }
373 }
374
375
376 void BufferView::copyEnvironment()
377 {
378         if (available()) {
379                 text->copyEnvironmentType();
380                 owner()->message(_("Paragraph environment type copied"));
381         }
382 }
383
384
385 void BufferView::pasteEnvironment()
386 {
387         if (available()) {
388                 text->pasteEnvironmentType(this);
389                 owner()->message(_("Paragraph environment type set"));
390                 update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
391         }
392 }
393
394
395 void BufferView::copy()
396 {
397         if (available()) {
398                 getLyXText()->copySelection(this);
399                 owner()->message(_("Copy"));
400         }
401 }
402
403
404 void BufferView::cut(bool realcut)
405 {
406         if (available()) {
407                 hideCursor();
408                 update(text, BufferView::SELECT|BufferView::FITCUR);
409                 text->cutSelection(this, true, realcut);
410                 update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
411                 owner()->message(_("Cut"));
412         }
413 }
414
415
416 void BufferView::paste()
417 {
418         if (!available())
419                 return;
420
421         owner()->message(_("Paste"));
422
423         hideCursor();
424         // clear the selection
425         toggleSelection();
426         text->clearSelection();
427         update(text, BufferView::SELECT|BufferView::FITCUR);
428
429         // paste
430         text->pasteSelection(this);
431         // bug 393
432         text->clearSelection();
433         update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
434 // why fake a selection only I think it should be a real one and not only
435 // a painted one (Jug 20020318).
436 #if 0
437         // clear the selection
438         toggleSelection();
439         text->clearSelection();
440         update(text, BufferView::SELECT|BufferView::FITCUR);
441 #endif
442 }
443
444
445 /* these functions are for the spellchecker */
446 string const BufferView::nextWord(float & value)
447 {
448         if (!available()) {
449                 value = 1;
450                 return string();
451         }
452
453         return text->selectNextWordToSpellcheck(this, value);
454 }
455
456
457 void BufferView::selectLastWord()
458 {
459         if (!available()) return;
460
461         LyXCursor cur = text->selection.cursor;
462         hideCursor();
463         beforeChange(text);
464         text->selection.cursor = cur;
465         text->selectSelectedWord(this);
466         toggleSelection(false);
467         update(text, BufferView::SELECT|BufferView::FITCUR);
468 }
469
470
471 void BufferView::endOfSpellCheck()
472 {
473         if (!available()) return;
474
475         hideCursor();
476         beforeChange(text);
477         text->selectSelectedWord(this);
478         text->clearSelection();
479         update(text, BufferView::SELECT|BufferView::FITCUR);
480 }
481
482
483 void BufferView::replaceWord(string const & replacestring)
484 {
485         if (!available()) return;
486
487         LyXText * tt = getLyXText();
488         hideCursor();
489         update(tt, BufferView::SELECT|BufferView::FITCUR);
490
491         /* clear the selection (if there is any) */
492         toggleSelection(false);
493         update(tt, BufferView::SELECT|BufferView::FITCUR);
494
495         /* clear the selection (if there is any) */
496         toggleSelection(false);
497         tt->replaceSelectionWithString(this, replacestring);
498
499         tt->setSelectionOverString(this, replacestring);
500
501         // Go back so that replacement string is also spellchecked
502         for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
503                 tt->cursorLeft(this);
504         }
505         update(tt, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
506 }
507 // End of spellchecker stuff
508
509
510 bool BufferView::lockInset(UpdatableInset * inset)
511 {
512         if (!inset)
513                 return false;
514         // don't relock if we're already locked
515         if (theLockingInset() == inset)
516                 return true;
517         if (!theLockingInset()) {
518                 // first check if it's the inset under the cursor we want lock
519                 // should be most of the time
520                 char const c = text->cursor.par()->getChar(text->cursor.pos());
521                 if (c == Paragraph::META_INSET) {
522                         Inset * in = text->cursor.par()->getInset(text->cursor.pos());
523                         if (inset == in) {
524                                 theLockingInset(inset);
525                                 return true;
526                         }
527                 }
528                 // Then do a deep look of the inset and lock the right one
529                 Paragraph * par = buffer()->paragraph;
530                 int const id = inset->id();
531                 while(par) {
532                         Paragraph::inset_iterator it =
533                                 par->inset_iterator_begin();
534                         Paragraph::inset_iterator const end =
535                                 par->inset_iterator_end();
536                         for (; it != end; ++it) {
537                                 if ((*it) == inset) {
538                                         text->setCursorIntern(this, par, it.getPos());
539                                         theLockingInset(inset);
540                                         return true;
541                                 }
542                                 if ((*it)->getInsetFromID(id)) {
543                                         text->setCursorIntern(this, par, it.getPos());
544                                         (*it)->edit(this);
545                                         return theLockingInset()->lockInsetInInset(this, inset);
546                                 }
547                         }
548                         par = par->next();
549                 }
550                 return false;
551         }
552         return theLockingInset()->lockInsetInInset(this, inset);
553 }
554
555
556 void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
557 {
558         if (available() && theLockingInset() && !theLockingInset()->nodraw()) {
559                 LyXCursor cursor = text->cursor;
560                 Inset * locking_inset = theLockingInset()->getLockingInset();
561
562                 if ((cursor.pos() - 1 >= 0) &&
563                     cursor.par()->isInset(cursor.pos() - 1) &&
564                     (cursor.par()->getInset(cursor.pos() - 1) ==
565                      locking_inset))
566                         text->setCursor(this, cursor,
567                                         cursor.par(), cursor.pos() - 1);
568                 LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE;
569                 LyXText * txt = getLyXText();
570                 if (locking_inset->isTextInset() &&
571                     locking_inset->lyxCode() != Inset::ERT_CODE &&
572                     (txt->real_current_font.language() !=
573                      buffer()->params.language
574                      || txt->real_current_font.isVisibleRightToLeft()
575                      != buffer()->params.language->RightToLeft()))
576                         shape = (txt->real_current_font.isVisibleRightToLeft())
577                                 ? LyXScreen::REVERSED_L_SHAPE
578                                 : LyXScreen::L_SHAPE;
579                 y += cursor.iy() + theLockingInset()->insetInInsetY();
580                 screen().showManualCursor(text, x, y, asc, desc,
581                                                   shape);
582         }
583 }
584
585
586 void BufferView::hideLockedInsetCursor()
587 {
588         if (theLockingInset() && available()) {
589                 screen().hideCursor();
590         }
591 }
592
593
594 bool BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
595 {
596         if (theLockingInset() && available()) {
597                 y += text->cursor.iy() + theLockingInset()->insetInInsetY();
598                 if (screen().fitManualCursor(this, text, x, y, asc, desc)) {
599                         updateScrollbar();
600                         return true;
601                 }
602         }
603         return false;
604 }
605
606
607 int BufferView::unlockInset(UpdatableInset * inset)
608 {
609         if (!inset)
610                 return 0;
611         if (inset && theLockingInset() == inset) {
612                 inset->insetUnlock(this);
613                 theLockingInset(0);
614                 // make sure we update the combo !
615                 owner()->setLayout(getLyXText()->cursor.par()->layout()->name());
616                 // Tell the paragraph dialog that we changed paragraph
617                 owner()->getDialogs()->updateParagraph();
618                 finishUndo();
619                 return 0;
620         } else if (inset && theLockingInset() &&
621                    theLockingInset()->unlockInsetInInset(this, inset)) {
622                 // Tell the paragraph dialog that we changed paragraph
623                 owner()->getDialogs()->updateParagraph();
624                 // owner inset has updated the layout combo
625                 finishUndo();
626                 return 0;
627         }
628         return bufferlist.unlockInset(inset);
629 }
630
631
632 void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
633 {
634         if (!theLockingInset())
635                 return; // shouldn't happen
636         if (kind == Undo::EDIT) // in this case insets would not be stored!
637                 kind = Undo::FINISH;
638         setUndo(this, kind,
639                 text->cursor.par(),
640                 text->cursor.par()->next());
641 }
642
643
644 void BufferView::updateInset(Inset * inset, bool mark_dirty)
645 {
646         pimpl_->updateInset(inset, mark_dirty);
647 }
648
649
650 bool BufferView::ChangeInsets(Inset::Code code,
651                               string const & from, string const & to)
652 {
653         bool need_update = false;
654         LyXCursor cursor = text->cursor;
655         LyXCursor tmpcursor = cursor;
656         cursor.par(tmpcursor.par());
657         cursor.pos(tmpcursor.pos());
658
659         ParIterator end = buffer()->par_iterator_end();
660         for (ParIterator it = buffer()->par_iterator_begin();
661              it != end; ++it) {
662                 Paragraph * par = *it;
663                 bool changed_inset = false;
664                 for (Paragraph::inset_iterator it2 = par->inset_iterator_begin();
665                      it2 != par->inset_iterator_end(); ++it2) {
666                         if ((*it2)->lyxCode() == code) {
667                                 InsetCommand * inset = static_cast<InsetCommand *>(*it2);
668                                 if (inset->getContents() == from) {
669                                         inset->setContents(to);
670                                         changed_inset = true;
671                                 }
672                         }
673                 }
674                 if (changed_inset) {
675                         need_update = true;
676
677                         // FIXME
678
679                         // The test it.size()==1 was needed to prevent crashes.
680                         // How to set the cursor corretly when it.size()>1 ??
681                         if (it.size() == 1) {
682                                 text->setCursorIntern(this, par, 0);
683                                 text->redoParagraphs(this, text->cursor,
684                                                      text->cursor.par()->next());
685                                 text->fullRebreak(this);
686                         }
687                 }
688         }
689         text->setCursorIntern(this, cursor.par(), cursor.pos());
690         return need_update;
691 }
692
693
694 bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
695 {
696         // Check if the label 'from' appears more than once
697         vector<string> labels = buffer()->getLabelList();
698
699         if (lyx::count(labels.begin(), labels.end(), from) > 1)
700                 return false;
701
702         return ChangeInsets(Inset::REF_CODE, from, to);
703 }
704
705
706 bool BufferView::ChangeCitationsIfUnique(string const & from,
707                                          string const & to)
708 {
709         typedef pair<string, string> StringPair;
710
711         vector<StringPair> keys = buffer()->getBibkeyList();
712         if (count_if(keys.begin(), keys.end(),
713                      lyx::equal_1st_in_pair<StringPair>(from))
714             > 1)
715                 return false;
716
717         return ChangeInsets(Inset::CITE_CODE, from, to);
718 }
719
720
721 UpdatableInset * BufferView::theLockingInset() const
722 {
723         // If NULL is not allowed we should put an Assert here. (Lgb)
724         if (text)
725                 return text->the_locking_inset;
726         return 0;
727 }
728
729
730 void BufferView::theLockingInset(UpdatableInset * inset)
731 {
732         text->the_locking_inset = inset;
733 }
734
735
736 LyXText * BufferView::getLyXText() const
737 {
738         if (theLockingInset()) {
739                 LyXText * txt = theLockingInset()->getLyXText(this, true);
740                 if (txt)
741                         return txt;
742         }
743         return text;
744 }
745
746
747 LyXText * BufferView::getParentText(Inset * inset) const
748 {
749         if (inset->owner()) {
750                 LyXText * txt = inset->getLyXText(this);
751                 inset = inset->owner();
752                 while (inset && inset->getLyXText(this) == txt)
753                         inset = inset->owner();
754                 if (inset)
755                         return inset->getLyXText(this);
756         }
757         return text;
758 }
759
760
761 Language const * BufferView::getParentLanguage(Inset * inset) const
762 {
763         LyXText * text = getParentText(inset);
764         return text->cursor.par()->getFontSettings(buffer()->params,
765                                                    text->cursor.pos()).language();
766 }