From 7d79437e36edffb4e72f9388d3f95c4d611a2ff5 Mon Sep 17 00:00:00 2001 From: Dmitrii Rubtsov Date: Wed, 15 Feb 2023 08:54:18 +0200 Subject: [PATCH] Force Syntax Highlighting #68 + Fix glitch when switching between tabs --- .../main/res/drawable-anydpi/ic_marker.xml | 9 +++ .../internal/SyntaxHighlightEditText.kt | 4 +- .../utils => ui/adapter}/TabController.kt | 2 +- .../{data/utils => ui/customview}/Panel.kt | 2 +- .../utils => ui/customview}/ToolbarManager.kt | 6 +- .../editor/ui/dialog/ForceSyntaxDialog.kt | 56 +++++++++++++ .../editor/ui/fragment/EditorFragment.kt | 23 +++--- .../editor/ui/navigation/EditorScreen.kt | 3 + .../editor/ui/viewmodel/EditorIntent.kt | 6 +- .../editor/ui/viewmodel/EditorViewModel.kt | 66 ++++++++++++---- .../editor/ui/viewstate/ToolbarViewState.kt | 3 +- .../main/res/menu/menu_overflow_vertical.xml | 10 +-- .../src/main/res/menu/menu_tools.xml | 10 +-- .../src/main/res/navigation/editor_graph.xml | 13 ++-- .../src/main/res/values-de/strings.xml | 4 +- .../src/main/res/values-fr/strings.xml | 4 +- .../src/main/res/values-pt/strings.xml | 4 +- .../src/main/res/values-ru/strings.xml | 4 +- .../src/main/res/values-zh-rTW/strings.xml | 4 +- .../src/main/res/values-zh/strings.xml | 4 +- .../src/main/res/values/arrays.xml | 78 +++++++++++++++++++ .../src/main/res/values/strings.xml | 4 +- .../ui/feature/editor/CloseTabTests.kt | 2 +- .../ui/feature/editor/MoveTabTests.kt | 2 +- .../ui/feature/editor/SaveFileTests.kt | 4 +- .../ui/feature/editor/SelectTabTests.kt | 2 +- .../src/main/res/raw/changelog.html | 3 +- 27 files changed, 264 insertions(+), 68 deletions(-) create mode 100644 common-ui/src/main/res/drawable-anydpi/ic_marker.xml rename feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/{data/utils => ui/adapter}/TabController.kt (98%) rename feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/{data/utils => ui/customview}/Panel.kt (91%) rename feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/{data/utils => ui/customview}/ToolbarManager.kt (98%) create mode 100644 feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/dialog/ForceSyntaxDialog.kt create mode 100644 feature-editor-impl/src/main/res/values/arrays.xml diff --git a/common-ui/src/main/res/drawable-anydpi/ic_marker.xml b/common-ui/src/main/res/drawable-anydpi/ic_marker.xml new file mode 100644 index 000000000..979c4d63b --- /dev/null +++ b/common-ui/src/main/res/drawable-anydpi/ic_marker.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/editorkit/src/main/kotlin/com/blacksquircle/ui/editorkit/widget/internal/SyntaxHighlightEditText.kt b/editorkit/src/main/kotlin/com/blacksquircle/ui/editorkit/widget/internal/SyntaxHighlightEditText.kt index b36bea970..ae2404df3 100644 --- a/editorkit/src/main/kotlin/com/blacksquircle/ui/editorkit/widget/internal/SyntaxHighlightEditText.kt +++ b/editorkit/src/main/kotlin/com/blacksquircle/ui/editorkit/widget/internal/SyntaxHighlightEditText.kt @@ -113,7 +113,9 @@ abstract class SyntaxHighlightEditText @JvmOverloads constructor( syntaxHighlight() } - open fun onLanguageChanged() = Unit + open fun onLanguageChanged() { + syntaxHighlight() + } open fun onColorSchemeChanged() { findResultStyleSpan = StyleSpan(color = colorScheme.findResultBackgroundColor) diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/TabController.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/adapter/TabController.kt similarity index 98% rename from feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/TabController.kt rename to feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/adapter/TabController.kt index 29aa95ec9..0fcec5195 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/TabController.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/adapter/TabController.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blacksquircle.ui.feature.editor.data.utils +package com.blacksquircle.ui.feature.editor.ui.adapter import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/Panel.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/customview/Panel.kt similarity index 91% rename from feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/Panel.kt rename to feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/customview/Panel.kt index fa465c34d..f69ea9859 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/Panel.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/customview/Panel.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blacksquircle.ui.feature.editor.data.utils +package com.blacksquircle.ui.feature.editor.ui.customview enum class Panel { DEFAULT, diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/ToolbarManager.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/customview/ToolbarManager.kt similarity index 98% rename from feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/ToolbarManager.kt rename to feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/customview/ToolbarManager.kt index 13c250360..39cdeede6 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/data/utils/ToolbarManager.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/customview/ToolbarManager.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blacksquircle.ui.feature.editor.data.utils +package com.blacksquircle.ui.feature.editor.ui.customview import android.content.res.Configuration import android.view.Menu @@ -104,7 +104,7 @@ class ToolbarManager( } // Tools Menu - // R.id.action_error_checking -> listener.onErrorCheckingButton() + R.id.action_force_syntax -> listener.onForceSyntaxButton() R.id.action_insert_color -> listener.onInsertColorButton() // Overflow Menu @@ -239,7 +239,7 @@ class ToolbarManager( fun onPreviousResultButton() fun onFindParamsChanged(params: FindParams) - // fun onErrorCheckingButton() + fun onForceSyntaxButton() fun onInsertColorButton() fun onUndoButton(): Boolean diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/dialog/ForceSyntaxDialog.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/dialog/ForceSyntaxDialog.kt new file mode 100644 index 000000000..433d6ff0b --- /dev/null +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/dialog/ForceSyntaxDialog.kt @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Squircle CE contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blacksquircle.ui.feature.editor.ui.dialog + +import android.annotation.SuppressLint +import android.app.Dialog +import android.os.Bundle +import androidx.fragment.app.DialogFragment +import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.navArgs +import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.list.listItemsSingleChoice +import com.blacksquircle.ui.feature.editor.R +import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorIntent +import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorViewModel +import dagger.hilt.android.AndroidEntryPoint + +@AndroidEntryPoint +class ForceSyntaxDialog : DialogFragment() { + + private val viewModel by activityViewModels() + private val navArgs by navArgs() + + @SuppressLint("CheckResult") + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + return MaterialDialog(requireContext()).show { + title(R.string.dialog_title_force_syntax) + + val languages = resources.getStringArray(R.array.language_name) + listItemsSingleChoice( + res = R.array.language_title, + initialSelection = languages.indexOf(navArgs.languageName), + waitForPositiveButton = false, + ) { _, index, _ -> + val intent = EditorIntent.ForceSyntaxHighlighting(languages[index]) + viewModel.obtainEvent(intent) + dismiss() + } + negativeButton(android.R.string.cancel) + } + } +} \ No newline at end of file diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/fragment/EditorFragment.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/fragment/EditorFragment.kt index 80f1619d1..6c0790356 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/fragment/EditorFragment.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/fragment/EditorFragment.kt @@ -55,13 +55,13 @@ import com.blacksquircle.ui.editorkit.plugin.textscroller.textScroller import com.blacksquircle.ui.editorkit.widget.TextScroller import com.blacksquircle.ui.editorkit.widget.internal.UndoRedoEditText import com.blacksquircle.ui.feature.editor.R -import com.blacksquircle.ui.feature.editor.data.utils.Panel import com.blacksquircle.ui.feature.editor.data.utils.SettingsEvent -import com.blacksquircle.ui.feature.editor.data.utils.TabController -import com.blacksquircle.ui.feature.editor.data.utils.ToolbarManager import com.blacksquircle.ui.feature.editor.databinding.FragmentEditorBinding import com.blacksquircle.ui.feature.editor.ui.adapter.AutoCompleteAdapter import com.blacksquircle.ui.feature.editor.ui.adapter.DocumentAdapter +import com.blacksquircle.ui.feature.editor.ui.adapter.TabController +import com.blacksquircle.ui.feature.editor.ui.customview.Panel +import com.blacksquircle.ui.feature.editor.ui.customview.ToolbarManager import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorIntent import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorViewEvent import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorViewModel @@ -93,7 +93,7 @@ class EditorFragment : Fragment(R.layout.fragment_editor), } private val onTabSelectedListener = object : TabAdapter.OnTabSelectedListener { - override fun onTabUnselected(position: Int) = saveFile() + override fun onTabUnselected(position: Int) = saveFile(local = false, unselected = true) override fun onTabSelected(position: Int) { viewModel.obtainEvent(EditorIntent.SelectTab(position)) } @@ -157,7 +157,7 @@ class EditorFragment : Fragment(R.layout.fragment_editor), override fun onPause() { super.onPause() - saveFile() + saveFile(local = false, unselected = false) } override fun handleOnBackPressed(): Boolean { @@ -178,6 +178,7 @@ class EditorFragment : Fragment(R.layout.fragment_editor), tabAdapter.submitList(state.documents, state.position) tabAdapter.setOnTabSelectedListener(onTabSelectedListener) tabAdapter.setOnTabMovedListener(onTabMovedListener) + binding.editor.language = state.documents[state.position].language toolbarManager.panel = state.panel if (state.panel == Panel.DEFAULT) { binding.editor.clearFindResultSpans() @@ -203,7 +204,6 @@ class EditorFragment : Fragment(R.layout.fragment_editor), binding.loadingBar.isVisible = false binding.scroller.state = TextScroller.State.HIDDEN - binding.editor.language = state.content.documentModel.language binding.editor.undoStack = state.content.undoStack binding.editor.redoStack = state.content.redoStack binding.editor.setTextContent(measurement) @@ -275,7 +275,7 @@ class EditorFragment : Fragment(R.layout.fragment_editor), } override fun onSaveButton(): Boolean { - saveFile(local = true) + saveFile(local = true, unselected = false) return true } @@ -316,7 +316,7 @@ class EditorFragment : Fragment(R.layout.fragment_editor), override fun onPasteButton(): Boolean { val position = tabAdapter.selectedPosition - if (binding.editor.hasPrimaryClip() && position > -1) { + if (position > -1 && binding.editor.hasPrimaryClip()) { binding.editor.paste() } else { context?.showToast(R.string.message_nothing_to_paste) @@ -388,6 +388,10 @@ class EditorFragment : Fragment(R.layout.fragment_editor), binding.editor.find(params) } + override fun onForceSyntaxButton() { + viewModel.obtainEvent(EditorIntent.ForceSyntax) + } + override fun onInsertColorButton() { viewModel.obtainEvent(EditorIntent.ColorPicker) } @@ -413,10 +417,11 @@ class EditorFragment : Fragment(R.layout.fragment_editor), // endregion TOOLBAR - private fun saveFile(local: Boolean = false) { + private fun saveFile(local: Boolean, unselected: Boolean) { if (!binding.editor.isVisible) return val action = EditorIntent.SaveFile( local = local, + unselected = unselected, text = binding.editor.text.toString(), undoStack = binding.editor.undoStack.clone(), redoStack = binding.editor.redoStack.clone(), diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/navigation/EditorScreen.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/navigation/EditorScreen.kt index 79f503229..00e0196f5 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/navigation/EditorScreen.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/navigation/EditorScreen.kt @@ -20,6 +20,9 @@ import com.blacksquircle.ui.core.ui.navigation.Screen sealed class EditorScreen(route: String) : Screen(route) { + class ForceSyntaxDialog(languageName: String) : EditorScreen( + route = "blacksquircle://editor/syntax?languageName=$languageName", + ) class CloseModifiedDialog(position: Int, fileName: String) : EditorScreen( route = "blacksquircle://editor/close?position=$position&fileName=$fileName", ) diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorIntent.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorIntent.kt index 7c55fb2f5..f443f2de1 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorIntent.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorIntent.kt @@ -38,9 +38,12 @@ sealed class EditorIntent { object ColorPicker : EditorIntent() data class InsertColor(val color: Int) : EditorIntent() - object ModifyContent : EditorIntent() + object ForceSyntax : EditorIntent() + data class ForceSyntaxHighlighting(val languageName: String) : EditorIntent() + data class SaveFile( val local: Boolean, + val unselected: Boolean, val text: String, val undoStack: UndoStack, val redoStack: UndoStack, @@ -50,6 +53,7 @@ sealed class EditorIntent { val selectionEnd: Int, ) : EditorIntent() data class SaveFileAs(val fileUri: Uri) : EditorIntent() + object ModifyContent : EditorIntent() object PanelDefault : EditorIntent() object PanelFind : EditorIntent() diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorViewModel.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorViewModel.kt index 3023288bf..508650fd0 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorViewModel.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewmodel/EditorViewModel.kt @@ -18,18 +18,19 @@ package com.blacksquircle.ui.feature.editor.ui.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.blacksquircle.ui.core.data.factory.LanguageFactory import com.blacksquircle.ui.core.data.storage.keyvalue.SettingsManager import com.blacksquircle.ui.core.domain.resources.StringProvider import com.blacksquircle.ui.core.ui.extensions.* import com.blacksquircle.ui.core.ui.viewstate.ViewEvent import com.blacksquircle.ui.feature.editor.R import com.blacksquircle.ui.feature.editor.data.converter.DocumentConverter -import com.blacksquircle.ui.feature.editor.data.utils.Panel import com.blacksquircle.ui.feature.editor.data.utils.SettingsEvent import com.blacksquircle.ui.feature.editor.domain.model.DocumentContent import com.blacksquircle.ui.feature.editor.domain.model.DocumentModel import com.blacksquircle.ui.feature.editor.domain.model.DocumentParams import com.blacksquircle.ui.feature.editor.domain.repository.DocumentRepository +import com.blacksquircle.ui.feature.editor.ui.customview.Panel import com.blacksquircle.ui.feature.editor.ui.navigation.EditorScreen import com.blacksquircle.ui.feature.editor.ui.viewstate.EditorViewState import com.blacksquircle.ui.feature.editor.ui.viewstate.ToolbarViewState @@ -90,9 +91,12 @@ class EditorViewModel @Inject constructor( is EditorIntent.ColorPicker -> colorPicker() is EditorIntent.InsertColor -> insertColor(event) - is EditorIntent.ModifyContent -> modifyContent() + is EditorIntent.ForceSyntax -> forceSyntax() + is EditorIntent.ForceSyntaxHighlighting -> forceSyntaxHighlighting(event) + is EditorIntent.SaveFile -> saveFile(event) is EditorIntent.SaveFileAs -> saveFileAs(event) + is EditorIntent.ModifyContent -> modifyContent() is EditorIntent.PanelDefault -> panelDefault() is EditorIntent.PanelFind -> panelFind() @@ -152,11 +156,12 @@ class EditorViewModel @Inject constructor( currentJob?.cancel() currentJob = viewModelScope.launch { try { + _editorViewState.value = EditorViewState.Loading + val document = documents[event.position] settingsManager.selectedUuid = document.uuid refreshActionBar(event.position) - _editorViewState.value = EditorViewState.Loading _editorViewState.value = EditorViewState.Content( content = documentRepository.loadFile(document), showKeyboard = settingsManager.extendedKeyboard, @@ -328,16 +333,6 @@ class EditorViewModel @Inject constructor( } } - private fun modifyContent() { - if (selectedPosition > -1) { - val document = documents[selectedPosition] - if (!document.modified) { - documents[selectedPosition] = document.copy(modified = true) - refreshActionBar(selectedPosition) - } - } - } - private fun saveFile(event: EditorIntent.SaveFile) { viewModelScope.launch { try { @@ -365,7 +360,7 @@ class EditorViewModel @Inject constructor( text = event.text, ) val params = DocumentParams(localStorage, true) - if (!localStorage) { + if (!localStorage && !event.unselected) { _editorViewState.value = currentState.copy(content = content) } documentRepository.saveFile(content, params) @@ -401,6 +396,49 @@ class EditorViewModel @Inject constructor( } } + private fun forceSyntax() { + viewModelScope.launch { + try { + if (selectedPosition > -1) { + val document = documents[selectedPosition] + val screen = EditorScreen.ForceSyntaxDialog(document.language.languageName) + _viewEvent.send(ViewEvent.Navigation(screen)) + } + } catch (e: Exception) { + Timber.e(e, e.message) + _viewEvent.send(ViewEvent.Toast(e.message.orEmpty())) + } + } + } + + private fun forceSyntaxHighlighting(event: EditorIntent.ForceSyntaxHighlighting) { + viewModelScope.launch { + try { + if (selectedPosition > -1) { + val document = documents[selectedPosition] + documents[selectedPosition] = document.copy( + language = LanguageFactory.fromName(event.languageName) + ) + documentRepository.updateDocument(document) + refreshActionBar(selectedPosition) + } + } catch (e: Exception) { + Timber.e(e, e.message) + _viewEvent.send(ViewEvent.Toast(e.message.orEmpty())) + } + } + } + + private fun modifyContent() { + if (selectedPosition > -1) { + val document = documents[selectedPosition] + if (!document.modified) { + documents[selectedPosition] = document.copy(modified = true) + refreshActionBar(selectedPosition) + } + } + } + private fun panelDefault() { panel = Panel.DEFAULT refreshActionBar(selectedPosition) diff --git a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewstate/ToolbarViewState.kt b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewstate/ToolbarViewState.kt index 0326f053c..14e19036d 100644 --- a/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewstate/ToolbarViewState.kt +++ b/feature-editor-impl/src/main/kotlin/com/blacksquircle/ui/feature/editor/ui/viewstate/ToolbarViewState.kt @@ -17,9 +17,8 @@ package com.blacksquircle.ui.feature.editor.ui.viewstate import com.blacksquircle.ui.core.ui.viewstate.ViewState -import com.blacksquircle.ui.feature.editor.data.utils.Panel import com.blacksquircle.ui.feature.editor.domain.model.DocumentModel -import java.util.* +import com.blacksquircle.ui.feature.editor.ui.customview.Panel sealed class ToolbarViewState : ViewState() { diff --git a/feature-editor-impl/src/main/res/menu/menu_overflow_vertical.xml b/feature-editor-impl/src/main/res/menu/menu_overflow_vertical.xml index f3fe5d630..0a763e57b 100644 --- a/feature-editor-impl/src/main/res/menu/menu_overflow_vertical.xml +++ b/feature-editor-impl/src/main/res/menu/menu_overflow_vertical.xml @@ -28,11 +28,11 @@ android:icon="@drawable/ic_tools" app:iconTint="@color/colorIcon"> - + - + + app:startDestination="@id/forceSyntaxDialog"> - + android:id="@+id/forceSyntaxDialog" + android:name="com.blacksquircle.ui.feature.editor.ui.dialog.ForceSyntaxDialog" + android:label="ForceSyntaxDialog"> + diff --git a/feature-editor-impl/src/main/res/values-de/strings.xml b/feature-editor-impl/src/main/res/values-de/strings.xml index d7c28daec..a22b0c279 100644 --- a/feature-editor-impl/src/main/res/values-de/strings.xml +++ b/feature-editor-impl/src/main/res/values-de/strings.xml @@ -43,14 +43,14 @@ Ersetzen schließen Gehe zu Zeile Gehe zu - + Force Syntax Farbe einfügen Einstellungen Tools - Ergebnis Gehe zu Zeile… Farbauswahl + Syntax Highlighting Sind Sie sicher, dass Sie die Datei schließen wollen? Alle ungespeicherten Änderungen werden verworfen diff --git a/feature-editor-impl/src/main/res/values-fr/strings.xml b/feature-editor-impl/src/main/res/values-fr/strings.xml index 9dcd0c31b..3a2ab47a9 100644 --- a/feature-editor-impl/src/main/res/values-fr/strings.xml +++ b/feature-editor-impl/src/main/res/values-fr/strings.xml @@ -43,14 +43,14 @@ Fermer Remplacer Aller à la Ligne Aller à - + Force Syntax Insérer une Couleur Paramètres Outils - Résultat Aller à la ligne… Sélecteur de Couleurs + Syntax Highlighting Voulez-vous vraiment fermer ce fichier? Toutes les modifications non enregistrées seront supprimées diff --git a/feature-editor-impl/src/main/res/values-pt/strings.xml b/feature-editor-impl/src/main/res/values-pt/strings.xml index f89b70e36..a6de492d6 100644 --- a/feature-editor-impl/src/main/res/values-pt/strings.xml +++ b/feature-editor-impl/src/main/res/values-pt/strings.xml @@ -43,14 +43,14 @@ Fechar substituir Ir para a linha Ir para - + Force Syntax Inserir cor Configurações Ferramentas - Resultado Ir para a linha… Paleta de cores + Syntax Highlighting Você tem certeza de que quer fechar este arquivo? Todas as mudanças serão discartadas diff --git a/feature-editor-impl/src/main/res/values-ru/strings.xml b/feature-editor-impl/src/main/res/values-ru/strings.xml index b31a2af55..932eb9cd0 100644 --- a/feature-editor-impl/src/main/res/values-ru/strings.xml +++ b/feature-editor-impl/src/main/res/values-ru/strings.xml @@ -43,14 +43,14 @@ Закрыть замену Перейти к строке Перейти - + Синтаксис Вставить цвет Настройки Инструменты - Результат Перейти к строке… Выберите цвет + Подсветка синтаксиса Вы уверены что хотите закрыть этот файл? Все несохраненные изменения будут сброшены diff --git a/feature-editor-impl/src/main/res/values-zh-rTW/strings.xml b/feature-editor-impl/src/main/res/values-zh-rTW/strings.xml index 6e1db1688..c8afac2c0 100644 --- a/feature-editor-impl/src/main/res/values-zh-rTW/strings.xml +++ b/feature-editor-impl/src/main/res/values-zh-rTW/strings.xml @@ -43,14 +43,14 @@ 關閉取代 跳到行 跳到 - + Force Syntax 插入顏色 設定 工具 - 結果 跳到行 顏色選擇器 + Syntax Highlighting 確定要關閉該檔案嗎?所有未儲存的更改將會遺失 diff --git a/feature-editor-impl/src/main/res/values-zh/strings.xml b/feature-editor-impl/src/main/res/values-zh/strings.xml index 0462f35f8..fcb811c88 100644 --- a/feature-editor-impl/src/main/res/values-zh/strings.xml +++ b/feature-editor-impl/src/main/res/values-zh/strings.xml @@ -43,14 +43,14 @@ 关闭替换 转到行 转到 - + Force Syntax 插入颜色 设置 工具 - 结果 跳转到行 颜色选择器 + Syntax Highlighting 确定要关闭该文件吗?所有未保存的更改将会丢失 diff --git a/feature-editor-impl/src/main/res/values/arrays.xml b/feature-editor-impl/src/main/res/values/arrays.xml new file mode 100644 index 000000000..5cf6b4949 --- /dev/null +++ b/feature-editor-impl/src/main/res/values/arrays.xml @@ -0,0 +1,78 @@ + + + + + + + ActionScript + C + C++ + C# + Groovy + HTML + Java + JavaScript + Json + Julia + Kotlin + Lisp + Lua + Markdown + PHP + Plain Text + Python + Ruby + Shell + Smali + SQL + TOML + TypeScript + Visual Basic + XML + YAML + + + + actionscript + c + cplusplus + csharp + groovy + html + java + javascript + json + julia + kotlin + lisp + lua + markdown + php + plaintext + python + ruby + shell + smali + sql + toml + typescript + visualbasic + xml + yaml + + + \ No newline at end of file diff --git a/feature-editor-impl/src/main/res/values/strings.xml b/feature-editor-impl/src/main/res/values/strings.xml index 2829f8a00..3bfea355c 100644 --- a/feature-editor-impl/src/main/res/values/strings.xml +++ b/feature-editor-impl/src/main/res/values/strings.xml @@ -44,14 +44,14 @@ Close Replace Go to Line Go to - + Force Syntax Insert Color Settings Tools - Result Go to Line… Color Picker + Syntax Highlighting Are you sure you want to close this file? All unsaved changes will be discarded diff --git a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/CloseTabTests.kt b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/CloseTabTests.kt index 42f77a7d1..0c4aaad1c 100644 --- a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/CloseTabTests.kt +++ b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/CloseTabTests.kt @@ -20,8 +20,8 @@ import com.blacksquircle.ui.core.data.storage.keyvalue.SettingsManager import com.blacksquircle.ui.core.domain.resources.StringProvider import com.blacksquircle.ui.core.tests.MainDispatcherRule import com.blacksquircle.ui.core.tests.TimberConsoleRule -import com.blacksquircle.ui.feature.editor.data.utils.Panel import com.blacksquircle.ui.feature.editor.domain.repository.DocumentRepository +import com.blacksquircle.ui.feature.editor.ui.customview.Panel import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorIntent import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorViewModel import com.blacksquircle.ui.feature.editor.ui.viewstate.ToolbarViewState diff --git a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/MoveTabTests.kt b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/MoveTabTests.kt index b94affaa5..6f36f607e 100644 --- a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/MoveTabTests.kt +++ b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/MoveTabTests.kt @@ -20,8 +20,8 @@ import com.blacksquircle.ui.core.data.storage.keyvalue.SettingsManager import com.blacksquircle.ui.core.domain.resources.StringProvider import com.blacksquircle.ui.core.tests.MainDispatcherRule import com.blacksquircle.ui.core.tests.TimberConsoleRule -import com.blacksquircle.ui.feature.editor.data.utils.Panel import com.blacksquircle.ui.feature.editor.domain.repository.DocumentRepository +import com.blacksquircle.ui.feature.editor.ui.customview.Panel import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorIntent import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorViewModel import com.blacksquircle.ui.feature.editor.ui.viewstate.ToolbarViewState diff --git a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SaveFileTests.kt b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SaveFileTests.kt index 25c4c98e1..acd76b50a 100644 --- a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SaveFileTests.kt +++ b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SaveFileTests.kt @@ -21,8 +21,8 @@ import com.blacksquircle.ui.core.domain.resources.StringProvider import com.blacksquircle.ui.core.tests.MainDispatcherRule import com.blacksquircle.ui.core.tests.TimberConsoleRule import com.blacksquircle.ui.editorkit.model.UndoStack -import com.blacksquircle.ui.feature.editor.data.utils.Panel import com.blacksquircle.ui.feature.editor.domain.repository.DocumentRepository +import com.blacksquircle.ui.feature.editor.ui.customview.Panel import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorIntent import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorViewModel import com.blacksquircle.ui.feature.editor.ui.viewstate.ToolbarViewState @@ -103,6 +103,7 @@ class SaveFileTests { val viewModel = editorViewModel() val intent = EditorIntent.SaveFile( local = true, // local storage + unselected = false, text = "whatever", undoStack = UndoStack(), redoStack = UndoStack(), @@ -135,6 +136,7 @@ class SaveFileTests { val viewModel = editorViewModel() val intent = EditorIntent.SaveFile( local = false, // cache only + unselected = false, text = "whatever", undoStack = UndoStack(), redoStack = UndoStack(), diff --git a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SelectTabTests.kt b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SelectTabTests.kt index 0a2cdbd35..af0845663 100644 --- a/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SelectTabTests.kt +++ b/feature-editor-impl/src/test/kotlin/com/blacksquircle/ui/feature/editor/SelectTabTests.kt @@ -21,9 +21,9 @@ import com.blacksquircle.ui.core.domain.resources.StringProvider import com.blacksquircle.ui.core.tests.MainDispatcherRule import com.blacksquircle.ui.core.tests.TimberConsoleRule import com.blacksquircle.ui.editorkit.model.UndoStack -import com.blacksquircle.ui.feature.editor.data.utils.Panel import com.blacksquircle.ui.feature.editor.domain.model.DocumentContent import com.blacksquircle.ui.feature.editor.domain.repository.DocumentRepository +import com.blacksquircle.ui.feature.editor.ui.customview.Panel import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorIntent import com.blacksquircle.ui.feature.editor.ui.viewmodel.EditorViewModel import com.blacksquircle.ui.feature.editor.ui.viewstate.EditorViewState diff --git a/feature-settings-impl/src/main/res/raw/changelog.html b/feature-settings-impl/src/main/res/raw/changelog.html index 533abdc61..3b4063405 100755 --- a/feature-settings-impl/src/main/res/raw/changelog.html +++ b/feature-settings-impl/src/main/res/raw/changelog.html @@ -16,7 +16,8 @@ v2023.1.1, 32 Mar. 2023
-• Fixed: Auto-save files didn't work
+• Added: «Force Syntax Highlighting» in Menu > Tools
+• Fixed: Auto-save files didn't work (7765daa)
• Bugfixes and minor improvements

v2023.1.0, 12 Feb. 2023