2019-09-13
_ STEa Ver 1.0.5 既知の問題点
●StatusBarが非表示の場合、Ctrl+Gで行番号を入力しても当該行に移動しない問題を修正
(Ctrl+Shift+G カラム位置移動, Ctrl+Alt+G ファイル先頭からのオフセット位置移動も同様)
● STEaでTab区切りテキストをコピー、ExcelやLibreOffice Calcに張り付けた際に、Tab認識されない。
(AvalonEditがクリップボードにHtml形式のデータを設定している事が影響している。)
(Ctrl+Shift+G カラム位置移動, Ctrl+Alt+G ファイル先頭からのオフセット位置移動も同様)
● STEaでTab区切りテキストをコピー、ExcelやLibreOffice Calcに張り付けた際に、Tab認識されない。
(AvalonEditがクリップボードにHtml形式のデータを設定している事が影響している。)
2点とも手元では修正済みで、SMCmのリリースと一緒に修正版をアップ予定です。
1つ目はタイミングの問題のようですが、今まで気づきませんでした。
2つ目の問題はAvalonEditの
ICSharpCode.AvalonEdit.Editing.Selection クラスのCreateDataObject メソッドの仕様が原因でした。
AvalonEditは色付強調表示している文字列をHtmlフォーマットでクリップボードに設定しています。
ExcelやLibreOffice Calcは貼り付け時にHtmlフォーマットの方を優先していると思われます。
(実際、C#のソースコードなど色付強調表示している文字列をSTEaでCopy、MS Wordに張り付けると色付でPasteされます。)
TextAreaに対してDataObjectの添付Event、SettingData にイベントハンドラを追加。
DataFormats.Htmlの追加をキャンセルすればOKです。
デフォルトではDataFormats.Htmlの追加をキャンセルする挙動にしますが、
コマンドラインオプションと設定画面で挙動変更可能にする予定です。
/// <summary>
/// Creates a data object containing the selection's text.
/// </summary>
public virtual DataObject CreateDataObject(TextArea textArea)
{
DataObject data = new DataObject();
// Ensure we use the appropriate newline sequence for the OS
string text = TextUtilities.NormalizeNewLines(GetText(), Environment.NewLine);
// Enable drag/drop to Word, Notepad++ and others
if (EditingCommandHandler.ConfirmDataFormat(textArea, data, DataFormats.UnicodeText)) {
data.SetText(text);
}
// Enable drag/drop to SciTe:
// We cannot use SetText, thus we need to use typeof(string).FullName as data format.
// new DataObject(object) calls SetData(object), which in turn calls SetData(Type, data),
// which then uses Type.FullName as format.
// We immitate that behavior here as well:
if (EditingCommandHandler.ConfirmDataFormat(textArea, data, typeof(string).FullName)) {
data.SetData(typeof(string).FullName, text);
}
// Also copy text in HTML format to clipboard - good for pasting text into Word
// or to the SharpDevelop forums.
if (EditingCommandHandler.ConfirmDataFormat(textArea, data, DataFormats.Html)) {
HtmlClipboard.SetHtml(data, CreateHtmlFragment(new HtmlOptions(textArea.Options)));
}
return data;
}
/// Creates a data object containing the selection's text.
/// </summary>
public virtual DataObject CreateDataObject(TextArea textArea)
{
DataObject data = new DataObject();
// Ensure we use the appropriate newline sequence for the OS
string text = TextUtilities.NormalizeNewLines(GetText(), Environment.NewLine);
// Enable drag/drop to Word, Notepad++ and others
if (EditingCommandHandler.ConfirmDataFormat(textArea, data, DataFormats.UnicodeText)) {
data.SetText(text);
}
// Enable drag/drop to SciTe:
// We cannot use SetText, thus we need to use typeof(string).FullName as data format.
// new DataObject(object) calls SetData(object), which in turn calls SetData(Type, data),
// which then uses Type.FullName as format.
// We immitate that behavior here as well:
if (EditingCommandHandler.ConfirmDataFormat(textArea, data, typeof(string).FullName)) {
data.SetData(typeof(string).FullName, text);
}
// Also copy text in HTML format to clipboard - good for pasting text into Word
// or to the SharpDevelop forums.
if (EditingCommandHandler.ConfirmDataFormat(textArea, data, DataFormats.Html)) {
HtmlClipboard.SetHtml(data, CreateHtmlFragment(new HtmlOptions(textArea.Options)));
}
return data;
}
[コメントを投稿する]