Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: tools/ddbg/lib/commando.dart

Issue 82823007: Fix a bug with command line history. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:math'; 8 import 'dart:math';
9 9
10 import 'terminfo.dart'; 10 import 'terminfo.dart';
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // Any edits get committed to history. 417 // Any edits get committed to history.
418 _replaceHistory(_currentLine, _linePos); 418 _replaceHistory(_currentLine, _linePos);
419 } 419 }
420 420
421 _linePos -= 1; 421 _linePos -= 1;
422 var line = _lines[_linePos]; 422 var line = _lines[_linePos];
423 _update(line, line.length); 423 _update(line, line.length);
424 } 424 }
425 425
426 void _historyNext() { 426 void _historyNext() {
427 if (_linePos == (_lines.length - 1)) { 427 // For the very first command, _linePos (0) will exceed
428 // (_lines.length - 1) (-1) so we use a ">=" here instead of an "==".
429 if (_linePos >= (_lines.length - 1)) {
428 return; 430 return;
429 } 431 }
430 432
431 // Any edits get committed to history. 433 // Any edits get committed to history.
432 _replaceHistory(_currentLine, _linePos); 434 _replaceHistory(_currentLine, _linePos);
433 435
434 _linePos += 1; 436 _linePos += 1;
435 var line = _lines[_linePos]; 437 var line = _lines[_linePos];
436 _update(line, line.length); 438 _update(line, line.length);
437 } 439 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 print('Received command($command)'); 703 print('Received command($command)');
702 } 704 }
703 } 705 }
704 706
705 707
706 void main() { 708 void main() {
707 stdout.writeln('[Commando demo]'); 709 stdout.writeln('[Commando demo]');
708 cmd = new Commando(stdin, stdout, _handleCommand, 710 cmd = new Commando(stdin, stdout, _handleCommand,
709 completer:_myCompleter); 711 completer:_myCompleter);
710 } 712 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698