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

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

Issue 105243002: Move an old change into a new client. Old client got messed up. (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 | « tools/ddbg.dart ('k') | 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 void _home() { 256 void _home() {
257 _updatePos(0); 257 _updatePos(0);
258 } 258 }
259 259
260 void _end() { 260 void _end() {
261 _updatePos(_currentLine.length); 261 _updatePos(_currentLine.length);
262 } 262 }
263 263
264 void _clearScreen() { 264 void _clearScreen() {
265 _stdout.write(_term.clear); 265 _stdout.write(_term.clear);
266 _term.resize();
267 _screenWidth = _term.cols - 1;
266 _writePromptAndLine(); 268 _writePromptAndLine();
267 } 269 }
268 270
269 void _kill() { 271 void _kill() {
270 var newLine = []; 272 var newLine = [];
271 newLine.addAll(_currentLine.take(_cursorPos)); 273 newLine.addAll(_currentLine.take(_cursorPos));
272 _killBuffer = _currentLine.skip(_cursorPos).toList(); 274 _killBuffer = _currentLine.skip(_cursorPos).toList();
273 _update(newLine, _cursorPos); 275 _update(newLine, _cursorPos);
274 } 276 }
275 277
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 _linePos = _lines.length; 367 _linePos = _lines.length;
366 368
367 _end(); 369 _end();
368 _stdout.writeln(); 370 _stdout.writeln();
369 371
370 // Call the user's command handler. 372 // Call the user's command handler.
371 _handleCommand(new String.fromCharCodes(_currentLine)); 373 _handleCommand(new String.fromCharCodes(_currentLine));
372 374
373 _currentLine = []; 375 _currentLine = [];
374 _cursorPos = 0; 376 _cursorPos = 0;
375 _linePos = _lines.length;
376 if (_promptShown) { 377 if (_promptShown) {
377 _writePrompt(); 378 _writePrompt();
378 } 379 }
379 } 380 }
380 381
381 void _leftArrow() { 382 void _leftArrow() {
382 _updatePos(_cursorPos - 1); 383 _updatePos(_cursorPos - 1);
383 } 384 }
384 385
385 void _rightArrow() { 386 void _rightArrow() {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 for (var i = 0; i < (newCol - curCol); i++) { 587 for (var i = 0; i < (newCol - curCol); i++) {
587 _stdout.write(_term.cursorForward); 588 _stdout.write(_term.cursorForward);
588 } 589 }
589 } 590 }
590 591
591 return newPos; 592 return newPos;
592 } 593 }
593 594
594 int _nextMargin(int pos) { 595 int _nextMargin(int pos) {
595 var truePos = pos + prompt.length; 596 var truePos = pos + prompt.length;
596 var curLine = _getLine(pos);
597 return ((truePos ~/ _screenWidth) + 1) * _screenWidth - prompt.length; 597 return ((truePos ~/ _screenWidth) + 1) * _screenWidth - prompt.length;
598 } 598 }
599 599
600 int _getLine(int pos) { 600 int _getLine(int pos) {
601 var truePos = pos + prompt.length; 601 var truePos = pos + prompt.length;
602 return truePos ~/ _screenWidth; 602 return truePos ~/ _screenWidth;
603 } 603 }
604 604
605 int _getCol(int pos) { 605 int _getCol(int pos) {
606 var truePos = pos + prompt.length; 606 var truePos = pos + prompt.length;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 print('Received command($command)'); 703 print('Received command($command)');
704 } 704 }
705 } 705 }
706 706
707 707
708 void main() { 708 void main() {
709 stdout.writeln('[Commando demo]'); 709 stdout.writeln('[Commando demo]');
710 cmd = new Commando(stdin, stdout, _handleCommand, 710 cmd = new Commando(stdin, stdout, _handleCommand,
711 completer:_myCompleter); 711 completer:_myCompleter);
712 } 712 }
OLDNEW
« no previous file with comments | « tools/ddbg.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698