1
1
mirror of https://github.com/kahole/edamagit.git synced 2024-09-11 07:15:31 +03:00

fixes rebase error message offset and makes error header visitable

Some git error messages included a single carriage return making a the
visting "click" logic off by one. This is now fixed by pruning these
characters. The error header is now also visitable by pressing enter.
This commit is contained in:
Kristian Andersen Hole 2022-09-05 11:24:43 +02:00
parent 153a2dcfe0
commit 92584e7991
3 changed files with 17 additions and 2 deletions

View File

@ -19,6 +19,8 @@ import { IssueView } from '../views/forge/issueView';
import { PullRequestItemView } from '../views/forge/pullRequestSectionView';
import { PullRequestView } from '../views/forge/pullRequestView';
import { sep } from 'path';
import { ErrorMessageView } from '../views/errorMessageView';
import { processView } from './processCommands';
export async function magitVisitAtPoint(repository: MagitRepository, currentView: DocumentView) {
@ -84,6 +86,8 @@ export async function magitVisitAtPoint(repository: MagitRepository, currentView
return ViewUtils.showView(uri, pullRequestView);
} else if (selectedView instanceof ErrorMessageView) {
return processView(repository);
} else {
window.setStatusBarMessage('There is no thing at point that could be visited', Constants.StatusMessageDisplayTimeout);
}

View File

@ -0,0 +1,11 @@
import { TextView } from './general/textView';
import * as Constants from '../common/constants';
export class ErrorMessageView extends TextView {
constructor(latestGitError: string) {
let truncated = latestGitError.split(Constants.LineSplitterRegex)[0] ?? '';
truncated = truncated.replace('\r', ' ').slice(0, 61);
super(`GitError! ${truncated} [ $ for detailed log ]`);
}
}

View File

@ -5,7 +5,6 @@ import { Section } from './general/sectionHeader';
import { DocumentView } from './general/documentView';
import { StashSectionView } from './stashes/stashSectionView';
import { CommitSectionView } from './commits/commitSectionView';
import { TextView } from './general/textView';
import { LineBreakView } from './general/lineBreakView';
import { Uri } from 'vscode';
import { BranchHeaderSectionView } from './branches/branchHeaderSectionView';
@ -19,6 +18,7 @@ import { MagitBranch } from '../models/magitBranch';
import { getLatestGitError } from '../commands/commandPrimer';
import { PullRequestSectionView } from './forge/pullRequestSectionView';
import { IssueSectionView } from './forge/issueSectionView';
import { ErrorMessageView } from './errorMessageView';
export default class MagitStatusView extends DocumentView {
@ -36,7 +36,7 @@ export default class MagitStatusView extends DocumentView {
let latestGitError = getLatestGitError(magitState);
if (latestGitError) {
this.addSubview(new TextView(`GitError! ${latestGitError.split(Constants.LineSplitterRegex)[0]} [ $ for detailed log ]`));
this.addSubview(new ErrorMessageView(latestGitError));
}
this.addSubview(new BranchHeaderSectionView(magitState.HEAD));