// -------------------------------------------------------------------- // VIRTUAL METHODS // -------------------------------------------------------------------- protected virtual void HandleCommandHistoryRequest(CommandHistoryDirection direction) { switch (direction) { case CommandHistoryDirection.BACKWARD: if (indexInLog > 0) indexInLog--; if (CommandLog.Count > 0) { Text = GetTextWithPromptSuffix(CommandLog[indexInLog].Raw); CaretIndex = Text.Length; } break; case CommandHistoryDirection.FORWARD: if (indexInLog < CommandLog.Count - 1) indexInLog++; if (CommandLog.Count > 0) { Text = GetTextWithPromptSuffix(CommandLog[indexInLog].Raw); CaretIndex = Text.Length; } break; } }
// -------------------------------------------------------------------- // VIRTUAL METHODS // -------------------------------------------------------------------- protected virtual void HandleCommandHistoryRequest(CommandHistoryDirection direction) { switch (direction) { case CommandHistoryDirection.BACKWARD: { try { if (indexInLog > 0) indexInLog--; if (CommandLog.Count > 0) { Document.Blocks.Remove(Document.Blocks.LastBlock); InsertNewPrompt(CommandLog[indexInLog].Raw.Trim()); this.ScrollToEnd(); this.CaretPosition = Document.Blocks.LastBlock.ContentEnd; } } catch (Exception ee) { } break; } case CommandHistoryDirection.FORWARD: { try { if (indexInLog < CommandLog.Count - 1) indexInLog++; if (indexInLog == CommandLog.Count - 1) { InsertNewPrompt(); this.ScrollToEnd(); this.CaretPosition = Document.Blocks.LastBlock.ContentEnd; } if (CommandLog.Count > 0) { Document.Blocks.Remove(Document.Blocks.LastBlock); InsertNewPrompt(CommandLog[indexInLog].Raw.Trim()); this.ScrollToEnd(); this.CaretPosition = Document.Blocks.LastBlock.ContentEnd; } } catch (Exception ee) { } break; } } }