Added: CTRL+Backspace

This commit is contained in:
ivandrofly 2014-06-25 14:26:41 +01:00
parent 64cea5ab9b
commit a57e010f17
2 changed files with 44 additions and 4 deletions

View File

@ -8,6 +8,7 @@ namespace Nikse.SubtitleEdit.Forms
public sealed partial class NetworkChat : Form public sealed partial class NetworkChat : Form
{ {
Logic.Networking.NikseWebServiceSession _networkSession; Logic.Networking.NikseWebServiceSession _networkSession;
private string breakChars = "\".!?,)([]<>:;♪{}-/#*| ¿¡" + Environment.NewLine + "\t";
protected override bool ShowWithoutActivation protected override bool ShowWithoutActivation
{ {
@ -73,6 +74,45 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true; e.SuppressKeyPress = true;
buttonSendChat_Click(null, null); buttonSendChat_Click(null, null);
} }
else
{
if (e.KeyData == (Keys.Control | Keys.A))
{
textBoxChat.SelectAll();
e.SuppressKeyPress = true;
}
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.Back)
{
int index = textBoxChat.SelectionStart;
if (textBoxChat.SelectionLength == 0)
{
var s = textBoxChat.Text;
int deleteFrom = index - 1;
if (deleteFrom > 0 && deleteFrom < s.Length)
{
if (s[deleteFrom] == ' ')
deleteFrom--;
while (deleteFrom > 0 && !(breakChars).Contains(s.Substring(deleteFrom, 1)))
{
deleteFrom--;
}
if (deleteFrom == index - 1)
{
while (deleteFrom > 0 && (breakChars.Replace(" ", string.Empty)).Contains(s.Substring(deleteFrom - 1, 1)))
{
deleteFrom--;
}
}
if (s[deleteFrom] == ' ')
deleteFrom++;
textBoxChat.Text = s.Remove(deleteFrom, index - deleteFrom);
textBoxChat.SelectionStart = deleteFrom;
}
}
e.SuppressKeyPress = true;
}
}
} }
internal void AddUser(SeNetworkService.SeUser user) internal void AddUser(SeNetworkService.SeUser user)

View File

@ -112,12 +112,12 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="imageListUsers.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="imageListUsers.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<data name="imageListUsers.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="imageListUsers.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAo ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAAD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