From 474b85063753a7f0c8b652e7af03e5e9ff2f1d72 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 29 Oct 2021 14:03:36 -0700 Subject: [PATCH] Add `LengthInBufferCells` back to `EditorServicesConsolePSHostRawUserInterface` These changes were accidentally forgotten in the rewrite and needed to be added back. --- ...orServicesConsolePSHostRawUserInterface.cs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs index de69ff6c3..acf866942 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostRawUserInterface.cs @@ -263,6 +263,53 @@ public override void SetBufferContents( _internalRawUI.SetBufferContents(origin, contents); } + /// + /// Determines the number of BufferCells a character occupies. + /// + /// + /// The character whose length we want to know. + /// + /// + /// The length in buffer cells according to the original host + /// implementation for the process. + /// + public override int LengthInBufferCells(char source) + { + return _internalRawUI.LengthInBufferCells(source); + } + /// + /// Determines the number of BufferCells a string occupies. + /// + /// + /// The string whose length we want to know. + /// + /// + /// The length in buffer cells according to the original host + /// implementation for the process. + /// + public override int LengthInBufferCells(string source) + { + return _internalRawUI.LengthInBufferCells(source); + } + + /// + /// Determines the number of BufferCells a substring of a string occupies. + /// + /// + /// The string whose substring length we want to know. + /// + /// + /// Offset where the substring begins in + /// + /// + /// The length in buffer cells according to the original host + /// implementation for the process. + /// + public override int LengthInBufferCells(string source, int offset) + { + return _internalRawUI.LengthInBufferCells(source, offset); + } + #endregion ///