diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Resources/InfoPanel.xfrm b/src/AddIns/Misc/SubversionAddIn/Project/Resources/InfoPanel.xfrm deleted file mode 100644 index 047acb7017..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Resources/InfoPanel.xfrm +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs index f59db93095..8515eb0884 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs @@ -45,20 +45,23 @@ namespace ICSharpCode.Svn mainTab.Dock = DockStyle.Fill; mainTab.Alignment = TabAlignment.Bottom; + Controls.Add(mainTab); TabPage infoTabPage = new TabPage("Info"); infoPanel = new InfoPanel(viewContent); - infoPanel.Dock = DockStyle.Fill; infoTabPage.Controls.Add(infoPanel); mainTab.TabPages.Add(infoTabPage); + infoPanel.Dock = DockStyle.Fill; + TabPage diffTabPage = new TabPage("Diff"); diffPanel = new DiffPanel(viewContent); - diffPanel.Dock = DockStyle.Fill; diffTabPage.Controls.Add(diffPanel); mainTab.TabPages.Add(diffTabPage); + diffPanel.Dock = DockStyle.Fill; + /* TabPage conflictTabPage = new TabPage("Conflicts"); Label todoLabel = new Label(); @@ -67,8 +70,6 @@ namespace ICSharpCode.Svn mainTab.TabPages.Add(conflictTabPage); */ - Controls.Add(mainTab); - Thread logMessageThread = new Thread(new ThreadStart(GetLogMessages)); logMessageThread.Name = "svnLogMessage"; logMessageThread.IsBackground = true; diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.Designer.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.Designer.cs new file mode 100644 index 0000000000..62f6192e20 --- /dev/null +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.Designer.cs @@ -0,0 +1,192 @@ +// +// +// +// +// $Revision$ +// +namespace ICSharpCode.Svn +{ + partial class InfoPanel + { + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Disposes resources used by the control. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + /// + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.revisionListView = new System.Windows.Forms.ListView(); + this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader3 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader4 = new System.Windows.Forms.ColumnHeader(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.changesListView = new System.Windows.Forms.ListView(); + this.columnHeader5 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader6 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader7 = new System.Windows.Forms.ColumnHeader(); + this.commentRichTextBox = new System.Windows.Forms.RichTextBox(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.Location = new System.Drawing.Point(3, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(709, 23); + this.label1.TabIndex = 0; + this.label1.Text = "&Revision history:"; + // + // revisionListView + // + this.revisionListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.revisionListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.columnHeader3, + this.columnHeader4}); + this.revisionListView.FullRowSelect = true; + this.revisionListView.GridLines = true; + this.revisionListView.HideSelection = false; + this.revisionListView.Location = new System.Drawing.Point(3, 26); + this.revisionListView.MultiSelect = false; + this.revisionListView.Name = "revisionListView"; + this.revisionListView.Size = new System.Drawing.Size(709, 238); + this.revisionListView.TabIndex = 1; + this.revisionListView.UseCompatibleStateImageBehavior = false; + this.revisionListView.View = System.Windows.Forms.View.Details; + // + // columnHeader1 + // + this.columnHeader1.Text = "Revision"; + // + // columnHeader2 + // + this.columnHeader2.Text = "Author"; + this.columnHeader2.Width = 100; + // + // columnHeader3 + // + this.columnHeader3.Text = "Date"; + this.columnHeader3.Width = 120; + // + // columnHeader4 + // + this.columnHeader4.Text = "Comment"; + this.columnHeader4.Width = 400; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.label1); + this.splitContainer1.Panel1.Controls.Add(this.revisionListView); + this.splitContainer1.Panel1MinSize = 75; + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.changesListView); + this.splitContainer1.Panel2.Controls.Add(this.commentRichTextBox); + this.splitContainer1.Panel2MinSize = 150; + this.splitContainer1.Size = new System.Drawing.Size(715, 542); + this.splitContainer1.SplitterDistance = 267; + this.splitContainer1.TabIndex = 2; + // + // changesListView + // + this.changesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.changesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader5, + this.columnHeader6, + this.columnHeader7}); + this.changesListView.FullRowSelect = true; + this.changesListView.Location = new System.Drawing.Point(3, 112); + this.changesListView.Name = "changesListView"; + this.changesListView.Size = new System.Drawing.Size(709, 156); + this.changesListView.TabIndex = 1; + this.changesListView.UseCompatibleStateImageBehavior = false; + this.changesListView.View = System.Windows.Forms.View.Details; + // + // columnHeader5 + // + this.columnHeader5.Text = "Action"; + // + // columnHeader6 + // + this.columnHeader6.Text = "Path"; + // + // columnHeader7 + // + this.columnHeader7.Text = "Copy from"; + // + // commentRichTextBox + // + this.commentRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.commentRichTextBox.BackColor = System.Drawing.SystemColors.Window; + this.commentRichTextBox.Location = new System.Drawing.Point(3, 3); + this.commentRichTextBox.Name = "commentRichTextBox"; + this.commentRichTextBox.ReadOnly = true; + this.commentRichTextBox.Size = new System.Drawing.Size(709, 103); + this.commentRichTextBox.TabIndex = 0; + this.commentRichTextBox.Text = ""; + // + // InfoPanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Name = "InfoPanel"; + this.Size = new System.Drawing.Size(715, 542); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.ResumeLayout(false); + this.ResumeLayout(false); + } + private System.Windows.Forms.ColumnHeader columnHeader7; + private System.Windows.Forms.ColumnHeader columnHeader6; + private System.Windows.Forms.ColumnHeader columnHeader5; + private System.Windows.Forms.ListView changesListView; + private System.Windows.Forms.RichTextBox commentRichTextBox; + private System.Windows.Forms.ColumnHeader columnHeader4; + private System.Windows.Forms.ColumnHeader columnHeader3; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.ListView revisionListView; + private System.Windows.Forms.Label label1; + } +} diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs index c3a3966097..96fa7c7798 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs @@ -1,19 +1,19 @@ -// +// // // -// +// // $Revision$ // using System; using System.Collections; +using System.ComponentModel; using System.Drawing; using System.Threading; using System.Windows.Forms; using ICSharpCode.Core; using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Gui.XmlForms; using NSvn.Core; namespace ICSharpCode.Svn @@ -21,25 +21,19 @@ namespace ICSharpCode.Svn /// /// Description of InfoPanel. /// - public class InfoPanel : BaseSharpDevelopUserControl + public partial class InfoPanel : UserControl { IViewContent viewContent; - ListView revisionList, changesList; public InfoPanel(IViewContent viewContent) { this.viewContent = viewContent; - SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream("ICSharpCode.Svn.Resources.InfoPanel.xfrm")); + InitializeComponent(); - revisionList = Get("revision"); - changesList = Get("changes"); - revisionList.SelectedIndexChanged += RevisionListViewSelectionChanged; - ControlDictionary["commentRichTextBox"].Enabled = false; - ControlDictionary["commentRichTextBox"].Font = ResourceService.DefaultMonospacedFont; - - // Work around WinForms/XmlForms bug: - ControlDictionary["splitter1"].Height = 3; + revisionListView.SelectedIndexChanged += RevisionListViewSelectionChanged; + commentRichTextBox.Font = ResourceService.DefaultMonospacedFont; + commentRichTextBox.Enabled = false; } public void ShowError(Exception ex) @@ -58,7 +52,7 @@ namespace ICSharpCode.Svn txt.Text += ex.ToString(); } txt.Dock = DockStyle.Fill; - revisionList.Controls.Add(txt); + revisionListView.Controls.Add(txt); } int lastRevision = -1; @@ -74,24 +68,24 @@ namespace ICSharpCode.Svn logMessage.Message }); newItem.Tag = logMessage; - revisionList.Items.Add(newItem); + revisionListView.Items.Add(newItem); } void RevisionListViewSelectionChanged(object sender, EventArgs e) { - changesList.Items.Clear(); - if (revisionList.SelectedItems.Count == 0) { - ControlDictionary["commentRichTextBox"].Text = ""; - ControlDictionary["commentRichTextBox"].Enabled = false; + changesListView.Items.Clear(); + if (revisionListView.SelectedItems.Count == 0) { + commentRichTextBox.Text = ""; + commentRichTextBox.Enabled = false; return; } - ControlDictionary["commentRichTextBox"].Enabled = true; - ListViewItem item = revisionList.SelectedItems[0]; + commentRichTextBox.Enabled = true; + ListViewItem item = revisionListView.SelectedItems[0]; LogMessage logMessage = item.Tag as LogMessage; - ControlDictionary["commentRichTextBox"].Text = logMessage.Message; + commentRichTextBox.Text = logMessage.Message; ChangedPathDictionary changes = logMessage.ChangedPaths; if (changes == null) { - changesList.Items.Add("Loading..."); + changesListView.Items.Add("Loading..."); if (!isLoadingChangedPaths) { isLoadingChangedPaths = true; loadChangedPathsItem = item; @@ -104,7 +98,7 @@ namespace ICSharpCode.Svn foreach (DictionaryEntry entry in changes) { string path = (string)entry.Key; path = path.Replace('\\', '/'); - SizeF size = g.MeasureString(path, changesList.Font); + SizeF size = g.MeasureString(path, changesListView.Font); if (size.Width + 4 > pathWidth) pathWidth = (int)size.Width + 4; ChangedPath change = (ChangedPath)entry.Value; @@ -113,7 +107,7 @@ namespace ICSharpCode.Svn copyFrom = string.Empty; } else { copyFrom = copyFrom + " : r" + change.CopyFromRevision; - size = g.MeasureString(copyFrom, changesList.Font); + size = g.MeasureString(copyFrom, changesListView.Font); if (size.Width + 4 > copyFromWidth) copyFromWidth = (int)size.Width + 4; } @@ -122,11 +116,11 @@ namespace ICSharpCode.Svn path, copyFrom }); - changesList.Items.Add(newItem); + changesListView.Items.Add(newItem); } } - changesList.Columns[1].Width = pathWidth; - changesList.Columns[2].Width = copyFromWidth; + changesListView.Columns[1].Width = pathWidth; + changesListView.Columns[2].Width = copyFromWidth; } } @@ -182,7 +176,7 @@ namespace ICSharpCode.Svn void ReceiveAllChangedPathsInvoked(LogMessage logMessage) { - foreach (ListViewItem item in revisionList.Items) { + foreach (ListViewItem item in revisionListView.Items) { LogMessage oldMessage = (LogMessage)item.Tag; if (oldMessage.Revision == logMessage.Revision) { item.Tag = logMessage; diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.resx b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj b/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj index c88ea3e95f..31c6f8ca5a 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj +++ b/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj @@ -46,6 +46,10 @@ Always + + + InfoPanel.cs + Form @@ -54,7 +58,6 @@ - @@ -77,9 +80,6 @@ Component - - UserControl - UserControl @@ -100,6 +100,9 @@ DiffPanel.cs + + InfoPanel.cs + diff --git a/src/Main/Base/Test/CSharpExpressionFinderTests.cs b/src/Main/Base/Test/CSharpExpressionFinderTests.cs index 72d5975d72..bd69a15271 100644 --- a/src/Main/Base/Test/CSharpExpressionFinderTests.cs +++ b/src/Main/Base/Test/CSharpExpressionFinderTests.cs @@ -822,6 +822,18 @@ class Main { Assert.AreEqual("\"hello, world!\"", result.Expression); Assert.AreEqual(ExpressionContext.Default, result.Context); } + + [Test] + public void InsideStringLiteral() + { + const string program = @"using System; +class Main { + string a = ""hello, "; + + ExpressionResult result = ef.FindExpression(program, program.Length); + Assert.IsNull(result.Expression); + Assert.AreEqual(ExpressionContext.Default, result.Context); + } } } diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs index 15e0dfada7..0d2aab355f 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs @@ -308,6 +308,10 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp { Init(text, offset); Token token; + Location lastError = Location.Empty; + lexer.Errors.Error = delegate (int errorLine, int errorCol, string errorMsg) { + lastError = new Location(errorCol, errorLine); + }; while ((token = lexer.NextToken()) != null) { if (token.kind == Tokens.EOF) break; @@ -315,7 +319,14 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp break; } ApplyToken(token); - if (targetPosition < token.EndLocation) { + if (targetPosition <= token.EndLocation) { + if (token.kind == Tokens.Literal) { + // do not return string literal as expression if offset was inside the literal, + // or if it was at the end of the literal when the literal was not terminated correctly. + if (targetPosition < token.EndLocation || lastError == token.Location) { + frame.lastExpressionStart = Location.Empty; + } + } break; } lastToken = token.kind;